This repository has been archived by the owner on Apr 11, 2024. It is now read-only.
generated from spatie/package-skeleton-laravel
-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
32b3ea9
commit 3646926
Showing
30 changed files
with
328 additions
and
73 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,5 +23,5 @@ | |
| | ||
*/ | ||
|
||
'views_prefix' => 'templates::', | ||
'views_prefix' => 'app::', | ||
]; |
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,8 @@ | ||
@import 'button.css'; | ||
@import 'card.css'; | ||
@import 'checkbox.css'; | ||
@import 'container.css'; | ||
@import 'dropdown.css'; | ||
@import 'form.css'; | ||
@import 'input.css'; | ||
@import 'navbar.css'; |
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,5 @@ | ||
@layer components { | ||
.card { | ||
@apply w-full bg-white px-6 py-12 shadow-sm sm:max-w-lg sm:rounded-xl sm:px-12 dark:bg-gray-900; | ||
} | ||
} |
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,7 @@ | ||
@layer components { | ||
.checkbox { | ||
&-group { | ||
@apply flex flex-1 items-center gap-1.5; | ||
} | ||
} | ||
} |
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,13 @@ | ||
@layer components { | ||
.form { | ||
@apply flex flex-col gap-6; | ||
} | ||
|
||
.field { | ||
@apply w-full; | ||
} | ||
|
||
.label { | ||
@apply block w-full text-sm font-medium leading-6 text-gray-950 dark:text-white; | ||
} | ||
} |
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,9 @@ | ||
@layer components { | ||
.radio { | ||
@apply hover:text-primary-500 inline-flex cursor-pointer items-center space-x-3 text-sm font-medium text-gray-400; | ||
|
||
label { | ||
@apply w-full; | ||
} | ||
} | ||
} |
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,3 @@ | ||
<div> | ||
{{-- nothing will be displayed here --}} | ||
</div> |
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,34 @@ | ||
<x-ui-container class="flex flex-col gap-y-6 h-screen items-center justify-center"> | ||
<x-ui-card> | ||
<form class="form" wire:submit="submit"> | ||
<x-forms-input | ||
wire:model="form.email" | ||
type="email" | ||
label="{{ __('Email') }}" | ||
required | ||
autofocus | ||
/> | ||
|
||
<x-forms-input | ||
wire:model="form.password" | ||
type="password" | ||
label="{{ __('Password') }}" | ||
required | ||
/> | ||
|
||
<x-forms-input | ||
wire:model="form.password_confirmation" | ||
type="password" | ||
label="{{ __('Confirm Password') }}" | ||
required | ||
/> | ||
|
||
<x-ui-button | ||
class="btn-primary" | ||
type="submit" | ||
> | ||
{{ __('Sign Up') }} | ||
</x-ui-button> | ||
</form> | ||
</x-ui-card> | ||
</x-ui-container> |
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,50 @@ | ||
<div | ||
wire:key="{{ $hash() }}" | ||
class="field" | ||
> | ||
<div {{ $attributes->class([ | ||
'checkbox-group' => filled($prepend || $append), | ||
'checkbox-error' => $errors->has($id()), | ||
]) }}> | ||
{{ $prepend }} | ||
|
||
@if ($label && $left) | ||
<x-forms-label | ||
{{ $attributes->only('required') }} | ||
for="{{ $id() }}" | ||
:$label | ||
/> | ||
@endif | ||
|
||
<input | ||
{{ $attributes | ||
->merge([ | ||
'id' => $id(), | ||
'type' => 'checkbox', | ||
]) | ||
->class([ | ||
'checkbox peer', | ||
'checkbox-prepend' => filled($prepend), | ||
'checkbox-append' => filled($append), | ||
'checkbox-error' => $errors->has($id()) | ||
]) | ||
}} | ||
/> | ||
|
||
@if ($label && ! $left) | ||
<x-forms-label | ||
{{ $attributes->only('required') }} | ||
for="{{ $id() }}" | ||
:$label | ||
/> | ||
@endif | ||
|
||
{{ $append }} | ||
</div> | ||
|
||
@error($id()) | ||
<div class="input-error"> | ||
<span>{{ $message }}</span> | ||
</div> | ||
@enderror | ||
</div> |
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,7 +1,7 @@ | ||
<label class="label"> | ||
<label class="label" {{ $attributes }}> | ||
<span>{{ $label }}</span> | ||
|
||
@if ($required) | ||
<span class="text-error">*</span> | ||
<span class="text-primary-400">*</span> | ||
@endif | ||
</label> |
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,32 @@ | ||
<?php | ||
|
||
namespace Foxws\LivewireUse\Auth\Controllers; | ||
|
||
use Foxws\LivewireUse\Views\Components\Page; | ||
use Livewire\Attributes\Layout; | ||
use Livewire\Features\SupportRedirects\Redirector; | ||
|
||
#[Layout('components.layouts.auth')] | ||
class LogoutController extends Page | ||
{ | ||
protected static string $view = 'auth.logout'; | ||
|
||
public function mount(): void | ||
{ | ||
$this->seo()->setTitle(__('Logout')); | ||
$this->seo()->setDescription(__('Account Logout')); | ||
|
||
$this->submit(); | ||
} | ||
|
||
public function submit(): Redirector | ||
{ | ||
auth()->logout(); | ||
|
||
request()->session()->invalidate(); | ||
|
||
request()->session()->regenerateToken(); | ||
|
||
return redirect('/'); | ||
} | ||
} |
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,30 @@ | ||
<?php | ||
|
||
namespace Foxws\LivewireUse\Auth\Controllers; | ||
|
||
use Foxws\LivewireUse\Auth\Forms\RegisterForm; | ||
use Foxws\LivewireUse\Views\Components\Page; | ||
use Livewire\Attributes\Layout; | ||
|
||
#[Layout('components.layouts.auth')] | ||
class RegisterController extends Page | ||
{ | ||
protected static string $view = 'auth.register'; | ||
|
||
public RegisterForm $form; | ||
|
||
public function mount(): void | ||
{ | ||
$this->seo()->setTitle(__('Register')); | ||
$this->seo()->setDescription(__('Sign up')); | ||
|
||
if (static::isAuthenticated()) { | ||
redirect()->intended(); | ||
} | ||
} | ||
|
||
public function submit(): void | ||
{ | ||
$this->form->submit(); | ||
} | ||
} |
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,63 @@ | ||
<?php | ||
|
||
namespace Foxws\LivewireUse\Auth\Forms; | ||
|
||
use Foxws\LivewireUse\Forms\Components\Form; | ||
use Illuminate\Auth\Events\Registered; | ||
use Illuminate\Foundation\Auth\User; | ||
use Illuminate\Support\Facades\Auth; | ||
use Illuminate\Support\Facades\Hash; | ||
use Illuminate\Validation\Rules\Password; | ||
use Livewire\Attributes\Validate; | ||
|
||
class RegisterForm extends Form | ||
{ | ||
protected static int $maxAttempts = 3; | ||
|
||
#[Validate] | ||
public ?string $email = null; | ||
|
||
#[Validate] | ||
public ?string $password = null; | ||
|
||
#[Validate] | ||
public ?string $password_confirmation = null; | ||
|
||
public function rules(): array | ||
{ | ||
return [ | ||
'email' => 'required|email|unique:users', | ||
'password' => [ | ||
'required', | ||
'confirmed', | ||
Password::defaults(), | ||
], | ||
'password_confirmation' => [ | ||
'required', | ||
Password::defaults(), | ||
], | ||
]; | ||
} | ||
|
||
protected function handle() | ||
{ | ||
$data = $this->only('email', 'password'); | ||
|
||
$data['password'] = Hash::make($data['password']); | ||
|
||
$user = $this->getUserModel()::create($data); | ||
|
||
request()->session()->regenerate(); | ||
|
||
auth()->login($user); | ||
|
||
event(new Registered($user)); | ||
|
||
redirect()->to('/'); | ||
} | ||
|
||
protected function getUserModel(): User | ||
{ | ||
return app(config('auth.providers.users.model')); | ||
} | ||
} |
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
Oops, something went wrong.