-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
285 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Models\User; | ||
use Illuminate\Http\Request; | ||
use Laravel\Socialite\Facades\Socialite; | ||
use Laravel\Socialite\Two\InvalidStateException; | ||
|
||
class AuthController extends Controller | ||
{ | ||
public function redirect() | ||
{ | ||
return Socialite::driver('google')->redirect(); | ||
} | ||
|
||
public function callback() | ||
{ | ||
try { | ||
$googleUser = Socialite::driver('google')->user(); | ||
} catch(InvalidStateException) { | ||
return redirect()->route('login'); | ||
} | ||
|
||
$user = User::updateOrCreate([ | ||
'email' => $googleUser->email | ||
], [ | ||
'name' => $googleUser->name, | ||
'avatar' => $googleUser->avatar | ||
]); | ||
|
||
auth()->login($user); | ||
|
||
return redirect()->route('dashboard'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace App\Livewire\Dashboard; | ||
|
||
use App\Models\Envelope; | ||
use Livewire\Attributes\Locked; | ||
use Livewire\Component; | ||
|
||
class EnvelopeCard extends Component | ||
{ | ||
#[Locked] | ||
public Envelope $envelope; | ||
|
||
public function rename(string $name) | ||
{ | ||
$this->authorize('update', $this->envelope); | ||
$this->envelope->update(['name' => $name]); | ||
} | ||
|
||
public function render() | ||
{ | ||
return view('livewire.dashboard.envelope-card'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
<div> | ||
@foreach($envelopes as $envelope) | ||
@livewire('dashboard.envelope', $envelope) | ||
@endforeach | ||
<div class="max-w-screen-sm mx-auto p-8"> | ||
<div class="grid gap-4 grid-cols-2"> | ||
@foreach($envelopes as $envelope) | ||
<livewire:dashboard.envelope-card :$envelope :key="$envelope->id"> | ||
@endforeach | ||
</div> | ||
</div> |
Oops, something went wrong.