Skip to content

Instantly share code, notes, and snippets.

@sweetycode
Created November 10, 2021 06:12
Show Gist options
  • Save sweetycode/f6edba6828ce58af50ff8165f28d5eff to your computer and use it in GitHub Desktop.
Save sweetycode/f6edba6828ce58af50ff8165f28d5eff to your computer and use it in GitHub Desktop.
laravel breeze install make changes
diff --git a/app/Http/Controllers/Auth/AuthenticatedSessionController.php b/app/Http/Controllers/Auth/AuthenticatedSessionController.php
new file mode 100644
index 0000000..09abe87
--- /dev/null
+++ b/app/Http/Controllers/Auth/AuthenticatedSessionController.php
@@ -0,0 +1,54 @@
+<?php
+
+namespace App\Http\Controllers\Auth;
+
+use App\Http\Controllers\Controller;
+use App\Http\Requests\Auth\LoginRequest;
+use App\Providers\RouteServiceProvider;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Auth;
+
+class AuthenticatedSessionController extends Controller
+{
+ /**
+ * Display the login view.
+ *
+ * @return \Illuminate\View\View
+ */
+ public function create()
+ {
+ return view('auth.login');
+ }
+
+ /**
+ * Handle an incoming authentication request.
+ *
+ * @param \App\Http\Requests\Auth\LoginRequest $request
+ * @return \Illuminate\Http\RedirectResponse
+ */
+ public function store(LoginRequest $request)
+ {
+ $request->authenticate();
+
+ $request->session()->regenerate();
+
+ return redirect()->intended(RouteServiceProvider::HOME);
+ }
+
+ /**
+ * Destroy an authenticated session.
+ *
+ * @param \Illuminate\Http\Request $request
+ * @return \Illuminate\Http\RedirectResponse
+ */
+ public function destroy(Request $request)
+ {
+ Auth::guard('web')->logout();
+
+ $request->session()->invalidate();
+
+ $request->session()->regenerateToken();
+
+ return redirect('/');
+ }
+}
diff --git a/app/Http/Controllers/Auth/ConfirmablePasswordController.php b/app/Http/Controllers/Auth/ConfirmablePasswordController.php
new file mode 100644
index 0000000..1175010
--- /dev/null
+++ b/app/Http/Controllers/Auth/ConfirmablePasswordController.php
@@ -0,0 +1,44 @@
+<?php
+
+namespace App\Http\Controllers\Auth;
+
+use App\Http\Controllers\Controller;
+use App\Providers\RouteServiceProvider;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Auth;
+use Illuminate\Validation\ValidationException;
+
+class ConfirmablePasswordController extends Controller
+{
+ /**
+ * Show the confirm password view.
+ *
+ * @return \Illuminate\View\View
+ */
+ public function show()
+ {
+ return view('auth.confirm-password');
+ }
+
+ /**
+ * Confirm the user's password.
+ *
+ * @param \Illuminate\Http\Request $request
+ * @return mixed
+ */
+ public function store(Request $request)
+ {
+ if (! Auth::guard('web')->validate([
+ 'email' => $request->user()->email,
+ 'password' => $request->password,
+ ])) {
+ throw ValidationException::withMessages([
+ 'password' => __('auth.password'),
+ ]);
+ }
+
+ $request->session()->put('auth.password_confirmed_at', time());
+
+ return redirect()->intended(RouteServiceProvider::HOME);
+ }
+}
diff --git a/app/Http/Controllers/Auth/EmailVerificationNotificationController.php b/app/Http/Controllers/Auth/EmailVerificationNotificationController.php
new file mode 100644
index 0000000..3362dca
--- /dev/null
+++ b/app/Http/Controllers/Auth/EmailVerificationNotificationController.php
@@ -0,0 +1,27 @@
+<?php
+
+namespace App\Http\Controllers\Auth;
+
+use App\Http\Controllers\Controller;
+use App\Providers\RouteServiceProvider;
+use Illuminate\Http\Request;
+
+class EmailVerificationNotificationController extends Controller
+{
+ /**
+ * Send a new email verification notification.
+ *
+ * @param \Illuminate\Http\Request $request
+ * @return \Illuminate\Http\RedirectResponse
+ */
+ public function store(Request $request)
+ {
+ if ($request->user()->hasVerifiedEmail()) {
+ return redirect()->intended(RouteServiceProvider::HOME);
+ }
+
+ $request->user()->sendEmailVerificationNotification();
+
+ return back()->with('status', 'verification-link-sent');
+ }
+}
diff --git a/app/Http/Controllers/Auth/EmailVerificationPromptController.php b/app/Http/Controllers/Auth/EmailVerificationPromptController.php
new file mode 100644
index 0000000..e247f95
--- /dev/null
+++ b/app/Http/Controllers/Auth/EmailVerificationPromptController.php
@@ -0,0 +1,23 @@
+<?php
+
+namespace App\Http\Controllers\Auth;
+
+use App\Http\Controllers\Controller;
+use App\Providers\RouteServiceProvider;
+use Illuminate\Http\Request;
+
+class EmailVerificationPromptController extends Controller
+{
+ /**
+ * Display the email verification prompt.
+ *
+ * @param \Illuminate\Http\Request $request
+ * @return mixed
+ */
+ public function __invoke(Request $request)
+ {
+ return $request->user()->hasVerifiedEmail()
+ ? redirect()->intended(RouteServiceProvider::HOME)
+ : view('auth.verify-email');
+ }
+}
diff --git a/app/Http/Controllers/Auth/NewPasswordController.php b/app/Http/Controllers/Auth/NewPasswordController.php
new file mode 100644
index 0000000..1df8e21
--- /dev/null
+++ b/app/Http/Controllers/Auth/NewPasswordController.php
@@ -0,0 +1,65 @@
+<?php
+
+namespace App\Http\Controllers\Auth;
+
+use App\Http\Controllers\Controller;
+use Illuminate\Auth\Events\PasswordReset;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Hash;
+use Illuminate\Support\Facades\Password;
+use Illuminate\Support\Str;
+use Illuminate\Validation\Rules;
+
+class NewPasswordController extends Controller
+{
+ /**
+ * Display the password reset view.
+ *
+ * @param \Illuminate\Http\Request $request
+ * @return \Illuminate\View\View
+ */
+ public function create(Request $request)
+ {
+ return view('auth.reset-password', ['request' => $request]);
+ }
+
+ /**
+ * Handle an incoming new password request.
+ *
+ * @param \Illuminate\Http\Request $request
+ * @return \Illuminate\Http\RedirectResponse
+ *
+ * @throws \Illuminate\Validation\ValidationException
+ */
+ public function store(Request $request)
+ {
+ $request->validate([
+ 'token' => ['required'],
+ 'email' => ['required', 'email'],
+ 'password' => ['required', 'confirmed', Rules\Password::defaults()],
+ ]);
+
+ // Here we will attempt to reset the user's password. If it is successful we
+ // will update the password on an actual user model and persist it to the
+ // database. Otherwise we will parse the error and return the response.
+ $status = Password::reset(
+ $request->only('email', 'password', 'password_confirmation', 'token'),
+ function ($user) use ($request) {
+ $user->forceFill([
+ 'password' => Hash::make($request->password),
+ 'remember_token' => Str::random(60),
+ ])->save();
+
+ event(new PasswordReset($user));
+ }
+ );
+
+ // If the password was successfully reset, we will redirect the user back to
+ // the application's home authenticated view. If there is an error we can
+ // redirect them back to where they came from with their error message.
+ return $status == Password::PASSWORD_RESET
+ ? redirect()->route('login')->with('status', __($status))
+ : back()->withInput($request->only('email'))
+ ->withErrors(['email' => __($status)]);
+ }
+}
diff --git a/app/Http/Controllers/Auth/PasswordResetLinkController.php b/app/Http/Controllers/Auth/PasswordResetLinkController.php
new file mode 100644
index 0000000..667ab94
--- /dev/null
+++ b/app/Http/Controllers/Auth/PasswordResetLinkController.php
@@ -0,0 +1,47 @@
+<?php
+
+namespace App\Http\Controllers\Auth;
+
+use App\Http\Controllers\Controller;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Password;
+
+class PasswordResetLinkController extends Controller
+{
+ /**
+ * Display the password reset link request view.
+ *
+ * @return \Illuminate\View\View
+ */
+ public function create()
+ {
+ return view('auth.forgot-password');
+ }
+
+ /**
+ * Handle an incoming password reset link request.
+ *
+ * @param \Illuminate\Http\Request $request
+ * @return \Illuminate\Http\RedirectResponse
+ *
+ * @throws \Illuminate\Validation\ValidationException
+ */
+ public function store(Request $request)
+ {
+ $request->validate([
+ 'email' => ['required', 'email'],
+ ]);
+
+ // We will send the password reset link to this user. Once we have attempted
+ // to send the link, we will examine the response then see the message we
+ // need to show to the user. Finally, we'll send out a proper response.
+ $status = Password::sendResetLink(
+ $request->only('email')
+ );
+
+ return $status == Password::RESET_LINK_SENT
+ ? back()->with('status', __($status))
+ : back()->withInput($request->only('email'))
+ ->withErrors(['email' => __($status)]);
+ }
+}
diff --git a/app/Http/Controllers/Auth/RegisteredUserController.php b/app/Http/Controllers/Auth/RegisteredUserController.php
new file mode 100644
index 0000000..487fedb
--- /dev/null
+++ b/app/Http/Controllers/Auth/RegisteredUserController.php
@@ -0,0 +1,54 @@
+<?php
+
+namespace App\Http\Controllers\Auth;
+
+use App\Http\Controllers\Controller;
+use App\Models\User;
+use App\Providers\RouteServiceProvider;
+use Illuminate\Auth\Events\Registered;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Hash;
+use Illuminate\Validation\Rules;
+
+class RegisteredUserController extends Controller
+{
+ /**
+ * Display the registration view.
+ *
+ * @return \Illuminate\View\View
+ */
+ public function create()
+ {
+ return view('auth.register');
+ }
+
+ /**
+ * Handle an incoming registration request.
+ *
+ * @param \Illuminate\Http\Request $request
+ * @return \Illuminate\Http\RedirectResponse
+ *
+ * @throws \Illuminate\Validation\ValidationException
+ */
+ public function store(Request $request)
+ {
+ $request->validate([
+ 'name' => ['required', 'string', 'max:255'],
+ 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
+ 'password' => ['required', 'confirmed', Rules\Password::defaults()],
+ ]);
+
+ $user = User::create([
+ 'name' => $request->name,
+ 'email' => $request->email,
+ 'password' => Hash::make($request->password),
+ ]);
+
+ event(new Registered($user));
+
+ Auth::login($user);
+
+ return redirect(RouteServiceProvider::HOME);
+ }
+}
diff --git a/app/Http/Controllers/Auth/VerifyEmailController.php b/app/Http/Controllers/Auth/VerifyEmailController.php
new file mode 100644
index 0000000..6baa9aa
--- /dev/null
+++ b/app/Http/Controllers/Auth/VerifyEmailController.php
@@ -0,0 +1,30 @@
+<?php
+
+namespace App\Http\Controllers\Auth;
+
+use App\Http\Controllers\Controller;
+use App\Providers\RouteServiceProvider;
+use Illuminate\Auth\Events\Verified;
+use Illuminate\Foundation\Auth\EmailVerificationRequest;
+
+class VerifyEmailController extends Controller
+{
+ /**
+ * Mark the authenticated user's email address as verified.
+ *
+ * @param \Illuminate\Foundation\Auth\EmailVerificationRequest $request
+ * @return \Illuminate\Http\RedirectResponse
+ */
+ public function __invoke(EmailVerificationRequest $request)
+ {
+ if ($request->user()->hasVerifiedEmail()) {
+ return redirect()->intended(RouteServiceProvider::HOME.'?verified=1');
+ }
+
+ if ($request->user()->markEmailAsVerified()) {
+ event(new Verified($request->user()));
+ }
+
+ return redirect()->intended(RouteServiceProvider::HOME.'?verified=1');
+ }
+}
diff --git a/app/Http/Requests/Auth/LoginRequest.php b/app/Http/Requests/Auth/LoginRequest.php
new file mode 100644
index 0000000..a539eb8
--- /dev/null
+++ b/app/Http/Requests/Auth/LoginRequest.php
@@ -0,0 +1,93 @@
+<?php
+
+namespace App\Http\Requests\Auth;
+
+use Illuminate\Auth\Events\Lockout;
+use Illuminate\Foundation\Http\FormRequest;
+use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\RateLimiter;
+use Illuminate\Support\Str;
+use Illuminate\Validation\ValidationException;
+
+class LoginRequest extends FormRequest
+{
+ /**
+ * Determine if the user is authorized to make this request.
+ *
+ * @return bool
+ */
+ public function authorize()
+ {
+ return true;
+ }
+
+ /**
+ * Get the validation rules that apply to the request.
+ *
+ * @return array
+ */
+ public function rules()
+ {
+ return [
+ 'email' => ['required', 'string', 'email'],
+ 'password' => ['required', 'string'],
+ ];
+ }
+
+ /**
+ * Attempt to authenticate the request's credentials.
+ *
+ * @return void
+ *
+ * @throws \Illuminate\Validation\ValidationException
+ */
+ public function authenticate()
+ {
+ $this->ensureIsNotRateLimited();
+
+ if (! Auth::attempt($this->only('email', 'password'), $this->boolean('remember'))) {
+ RateLimiter::hit($this->throttleKey());
+
+ throw ValidationException::withMessages([
+ 'email' => __('auth.failed'),
+ ]);
+ }
+
+ RateLimiter::clear($this->throttleKey());
+ }
+
+ /**
+ * Ensure the login request is not rate limited.
+ *
+ * @return void
+ *
+ * @throws \Illuminate\Validation\ValidationException
+ */
+ public function ensureIsNotRateLimited()
+ {
+ if (! RateLimiter::tooManyAttempts($this->throttleKey(), 5)) {
+ return;
+ }
+
+ event(new Lockout($this));
+
+ $seconds = RateLimiter::availableIn($this->throttleKey());
+
+ throw ValidationException::withMessages([
+ 'email' => trans('auth.throttle', [
+ 'seconds' => $seconds,
+ 'minutes' => ceil($seconds / 60),
+ ]),
+ ]);
+ }
+
+ /**
+ * Get the rate limiting throttle key for the request.
+ *
+ * @return string
+ */
+ public function throttleKey()
+ {
+ return Str::lower($this->input('email')).'|'.$this->ip();
+ }
+}
diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php
index 3bd3c81..ca027ea 100644
--- a/app/Providers/RouteServiceProvider.php
+++ b/app/Providers/RouteServiceProvider.php
@@ -17,7 +17,7 @@ class RouteServiceProvider extends ServiceProvider
*
* @var string
*/
- public const HOME = '/home';
+ public const HOME = '/dashboard';
/**
* The controller namespace for the application.
diff --git a/app/View/Components/AppLayout.php b/app/View/Components/AppLayout.php
new file mode 100644
index 0000000..b45d342
--- /dev/null
+++ b/app/View/Components/AppLayout.php
@@ -0,0 +1,18 @@
+<?php
+
+namespace App\View\Components;
+
+use Illuminate\View\Component;
+
+class AppLayout extends Component
+{
+ /**
+ * Get the view / contents that represents the component.
+ *
+ * @return \Illuminate\View\View
+ */
+ public function render()
+ {
+ return view('layouts.app');
+ }
+}
diff --git a/app/View/Components/GuestLayout.php b/app/View/Components/GuestLayout.php
new file mode 100644
index 0000000..04cc559
--- /dev/null
+++ b/app/View/Components/GuestLayout.php
@@ -0,0 +1,18 @@
+<?php
+
+namespace App\View\Components;
+
+use Illuminate\View\Component;
+
+class GuestLayout extends Component
+{
+ /**
+ * Get the view / contents that represents the component.
+ *
+ * @return \Illuminate\View\View
+ */
+ public function render()
+ {
+ return view('layouts.guest');
+ }
+}
diff --git a/composer.json b/composer.json
index 61f4912..aac96ad 100644
--- a/composer.json
+++ b/composer.json
@@ -15,6 +15,7 @@
"require-dev": {
"facade/ignition": "^2.5",
"fakerphp/faker": "^1.9.1",
+ "laravel/breeze": "^1.4",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^5.10",
diff --git a/composer.lock b/composer.lock
index 7dfe291..b2f1374 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "d4842c22e789d247c4b660e69490545f",
+ "content-hash": "ab2417df9ed9aebff8e5aea69a80a584",
"packages": [
{
"name": "asm89/stack-cors",
@@ -6364,6 +6364,69 @@
},
"time": "2020-07-09T08:09:16+00:00"
},
+ {
+ "name": "laravel/breeze",
+ "version": "v1.4.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/laravel/breeze.git",
+ "reference": "bb97d9a56fe74d9bd0de3ea6ac162ea033637adb"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/laravel/breeze/zipball/bb97d9a56fe74d9bd0de3ea6ac162ea033637adb",
+ "reference": "bb97d9a56fe74d9bd0de3ea6ac162ea033637adb",
+ "shasum": "",
+ "mirrors": [
+ {
+ "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+ "preferred": true
+ }
+ ]
+ },
+ "require": {
+ "illuminate/filesystem": "^8.42",
+ "illuminate/support": "^8.42",
+ "illuminate/validation": "^8.42",
+ "php": "^7.3|^8.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.x-dev"
+ },
+ "laravel": {
+ "providers": [
+ "Laravel\\Breeze\\BreezeServiceProvider"
+ ]
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Laravel\\Breeze\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Taylor Otwell",
+ "email": "taylor@laravel.com"
+ }
+ ],
+ "description": "Minimal Laravel authentication scaffolding with Blade and Tailwind.",
+ "keywords": [
+ "auth",
+ "laravel"
+ ],
+ "support": {
+ "issues": "https://github.com/laravel/breeze/issues",
+ "source": "https://github.com/laravel/breeze"
+ },
+ "time": "2021-11-02T15:52:42+00:00"
+ },
{
"name": "laravel/sail",
"version": "v1.12.4",
diff --git a/package.json b/package.json
index 00c6506..1adbb9c 100644
--- a/package.json
+++ b/package.json
@@ -10,9 +10,14 @@
"production": "mix --production"
},
"devDependencies": {
+ "@tailwindcss/forms": "^0.2.1",
+ "alpinejs": "^3.4.2",
+ "autoprefixer": "^10.1.0",
"axios": "^0.21",
"laravel-mix": "^6.0.6",
"lodash": "^4.17.19",
- "postcss": "^8.1.14"
+ "postcss": "^8.2.1",
+ "postcss-import": "^12.0.1",
+ "tailwindcss": "^2.0.2"
}
}
diff --git a/resources/css/app.css b/resources/css/app.css
index e69de29..a31e444 100644
--- a/resources/css/app.css
+++ b/resources/css/app.css
@@ -0,0 +1,3 @@
+@import 'tailwindcss/base';
+@import 'tailwindcss/components';
+@import 'tailwindcss/utilities';
diff --git a/resources/js/app.js b/resources/js/app.js
index 40c55f6..08dba8d 100644
--- a/resources/js/app.js
+++ b/resources/js/app.js
@@ -1 +1,7 @@
require('./bootstrap');
+
+import Alpine from 'alpinejs';
+
+window.Alpine = Alpine;
+
+Alpine.start();
diff --git a/resources/views/auth/confirm-password.blade.php b/resources/views/auth/confirm-password.blade.php
new file mode 100644
index 0000000..466593a
--- /dev/null
+++ b/resources/views/auth/confirm-password.blade.php
@@ -0,0 +1,36 @@
+<x-guest-layout>
+ <x-auth-card>
+ <x-slot name="logo">
+ <a href="/">
+ <x-application-logo class="w-20 h-20 fill-current text-gray-500" />
+ </a>
+ </x-slot>
+
+ <div class="mb-4 text-sm text-gray-600">
+ {{ __('This is a secure area of the application. Please confirm your password before continuing.') }}
+ </div>
+
+ <!-- Validation Errors -->
+ <x-auth-validation-errors class="mb-4" :errors="$errors" />
+
+ <form method="POST" action="{{ route('password.confirm') }}">
+ @csrf
+
+ <!-- Password -->
+ <div>
+ <x-label for="password" :value="__('Password')" />
+
+ <x-input id="password" class="block mt-1 w-full"
+ type="password"
+ name="password"
+ required autocomplete="current-password" />
+ </div>
+
+ <div class="flex justify-end mt-4">
+ <x-button>
+ {{ __('Confirm') }}
+ </x-button>
+ </div>
+ </form>
+ </x-auth-card>
+</x-guest-layout>
diff --git a/resources/views/auth/forgot-password.blade.php b/resources/views/auth/forgot-password.blade.php
new file mode 100644
index 0000000..0642fa8
--- /dev/null
+++ b/resources/views/auth/forgot-password.blade.php
@@ -0,0 +1,36 @@
+<x-guest-layout>
+ <x-auth-card>
+ <x-slot name="logo">
+ <a href="/">
+ <x-application-logo class="w-20 h-20 fill-current text-gray-500" />
+ </a>
+ </x-slot>
+
+ <div class="mb-4 text-sm text-gray-600">
+ {{ __('Forgot your password? No problem. Just let us know your email address and we will email you a password reset link that will allow you to choose a new one.') }}
+ </div>
+
+ <!-- Session Status -->
+ <x-auth-session-status class="mb-4" :status="session('status')" />
+
+ <!-- Validation Errors -->
+ <x-auth-validation-errors class="mb-4" :errors="$errors" />
+
+ <form method="POST" action="{{ route('password.email') }}">
+ @csrf
+
+ <!-- Email Address -->
+ <div>
+ <x-label for="email" :value="__('Email')" />
+
+ <x-input id="email" class="block mt-1 w-full" type="email" name="email" :value="old('email')" required autofocus />
+ </div>
+
+ <div class="flex items-center justify-end mt-4">
+ <x-button>
+ {{ __('Email Password Reset Link') }}
+ </x-button>
+ </div>
+ </form>
+ </x-auth-card>
+</x-guest-layout>
diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php
new file mode 100644
index 0000000..ecbe174
--- /dev/null
+++ b/resources/views/auth/login.blade.php
@@ -0,0 +1,56 @@
+<x-guest-layout>
+ <x-auth-card>
+ <x-slot name="logo">
+ <a href="/">
+ <x-application-logo class="w-20 h-20 fill-current text-gray-500" />
+ </a>
+ </x-slot>
+
+ <!-- Session Status -->
+ <x-auth-session-status class="mb-4" :status="session('status')" />
+
+ <!-- Validation Errors -->
+ <x-auth-validation-errors class="mb-4" :errors="$errors" />
+
+ <form method="POST" action="{{ route('login') }}">
+ @csrf
+
+ <!-- Email Address -->
+ <div>
+ <x-label for="email" :value="__('Email')" />
+
+ <x-input id="email" class="block mt-1 w-full" type="email" name="email" :value="old('email')" required autofocus />
+ </div>
+
+ <!-- Password -->
+ <div class="mt-4">
+ <x-label for="password" :value="__('Password')" />
+
+ <x-input id="password" class="block mt-1 w-full"
+ type="password"
+ name="password"
+ required autocomplete="current-password" />
+ </div>
+
+ <!-- Remember Me -->
+ <div class="block mt-4">
+ <label for="remember_me" class="inline-flex items-center">
+ <input id="remember_me" type="checkbox" class="rounded border-gray-300 text-indigo-600 shadow-sm focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50" name="remember">
+ <span class="ml-2 text-sm text-gray-600">{{ __('Remember me') }}</span>
+ </label>
+ </div>
+
+ <div class="flex items-center justify-end mt-4">
+ @if (Route::has('password.request'))
+ <a class="underline text-sm text-gray-600 hover:text-gray-900" href="{{ route('password.request') }}">
+ {{ __('Forgot your password?') }}
+ </a>
+ @endif
+
+ <x-button class="ml-3">
+ {{ __('Log in') }}
+ </x-button>
+ </div>
+ </form>
+ </x-auth-card>
+</x-guest-layout>
diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php
new file mode 100644
index 0000000..a0c4fbe
--- /dev/null
+++ b/resources/views/auth/register.blade.php
@@ -0,0 +1,59 @@
+<x-guest-layout>
+ <x-auth-card>
+ <x-slot name="logo">
+ <a href="/">
+ <x-application-logo class="w-20 h-20 fill-current text-gray-500" />
+ </a>
+ </x-slot>
+
+ <!-- Validation Errors -->
+ <x-auth-validation-errors class="mb-4" :errors="$errors" />
+
+ <form method="POST" action="{{ route('register') }}">
+ @csrf
+
+ <!-- Name -->
+ <div>
+ <x-label for="name" :value="__('Name')" />
+
+ <x-input id="name" class="block mt-1 w-full" type="text" name="name" :value="old('name')" required autofocus />
+ </div>
+
+ <!-- Email Address -->
+ <div class="mt-4">
+ <x-label for="email" :value="__('Email')" />
+
+ <x-input id="email" class="block mt-1 w-full" type="email" name="email" :value="old('email')" required />
+ </div>
+
+ <!-- Password -->
+ <div class="mt-4">
+ <x-label for="password" :value="__('Password')" />
+
+ <x-input id="password" class="block mt-1 w-full"
+ type="password"
+ name="password"
+ required autocomplete="new-password" />
+ </div>
+
+ <!-- Confirm Password -->
+ <div class="mt-4">
+ <x-label for="password_confirmation" :value="__('Confirm Password')" />
+
+ <x-input id="password_confirmation" class="block mt-1 w-full"
+ type="password"
+ name="password_confirmation" required />
+ </div>
+
+ <div class="flex items-center justify-end mt-4">
+ <a class="underline text-sm text-gray-600 hover:text-gray-900" href="{{ route('login') }}">
+ {{ __('Already registered?') }}
+ </a>
+
+ <x-button class="ml-4">
+ {{ __('Register') }}
+ </x-button>
+ </div>
+ </form>
+ </x-auth-card>
+</x-guest-layout>
diff --git a/resources/views/auth/reset-password.blade.php b/resources/views/auth/reset-password.blade.php
new file mode 100644
index 0000000..979d1b4
--- /dev/null
+++ b/resources/views/auth/reset-password.blade.php
@@ -0,0 +1,48 @@
+<x-guest-layout>
+ <x-auth-card>
+ <x-slot name="logo">
+ <a href="/">
+ <x-application-logo class="w-20 h-20 fill-current text-gray-500" />
+ </a>
+ </x-slot>
+
+ <!-- Validation Errors -->
+ <x-auth-validation-errors class="mb-4" :errors="$errors" />
+
+ <form method="POST" action="{{ route('password.update') }}">
+ @csrf
+
+ <!-- Password Reset Token -->
+ <input type="hidden" name="token" value="{{ $request->route('token') }}">
+
+ <!-- Email Address -->
+ <div>
+ <x-label for="email" :value="__('Email')" />
+
+ <x-input id="email" class="block mt-1 w-full" type="email" name="email" :value="old('email', $request->email)" required autofocus />
+ </div>
+
+ <!-- Password -->
+ <div class="mt-4">
+ <x-label for="password" :value="__('Password')" />
+
+ <x-input id="password" class="block mt-1 w-full" type="password" name="password" required />
+ </div>
+
+ <!-- Confirm Password -->
+ <div class="mt-4">
+ <x-label for="password_confirmation" :value="__('Confirm Password')" />
+
+ <x-input id="password_confirmation" class="block mt-1 w-full"
+ type="password"
+ name="password_confirmation" required />
+ </div>
+
+ <div class="flex items-center justify-end mt-4">
+ <x-button>
+ {{ __('Reset Password') }}
+ </x-button>
+ </div>
+ </form>
+ </x-auth-card>
+</x-guest-layout>
diff --git a/resources/views/auth/verify-email.blade.php b/resources/views/auth/verify-email.blade.php
new file mode 100644
index 0000000..dc0ae7f
--- /dev/null
+++ b/resources/views/auth/verify-email.blade.php
@@ -0,0 +1,39 @@
+<x-guest-layout>
+ <x-auth-card>
+ <x-slot name="logo">
+ <a href="/">
+ <x-application-logo class="w-20 h-20 fill-current text-gray-500" />
+ </a>
+ </x-slot>
+
+ <div class="mb-4 text-sm text-gray-600">
+ {{ __('Thanks for signing up! Before getting started, could you verify your email address by clicking on the link we just emailed to you? If you didn\'t receive the email, we will gladly send you another.') }}
+ </div>
+
+ @if (session('status') == 'verification-link-sent')
+ <div class="mb-4 font-medium text-sm text-green-600">
+ {{ __('A new verification link has been sent to the email address you provided during registration.') }}
+ </div>
+ @endif
+
+ <div class="mt-4 flex items-center justify-between">
+ <form method="POST" action="{{ route('verification.send') }}">
+ @csrf
+
+ <div>
+ <x-button>
+ {{ __('Resend Verification Email') }}
+ </x-button>
+ </div>
+ </form>
+
+ <form method="POST" action="{{ route('logout') }}">
+ @csrf
+
+ <button type="submit" class="underline text-sm text-gray-600 hover:text-gray-900">
+ {{ __('Log Out') }}
+ </button>
+ </form>
+ </div>
+ </x-auth-card>
+</x-guest-layout>
diff --git a/resources/views/components/application-logo.blade.php b/resources/views/components/application-logo.blade.php
new file mode 100644
index 0000000..46579cf
--- /dev/null
+++ b/resources/views/components/application-logo.blade.php
@@ -0,0 +1,3 @@
+<svg viewBox="0 0 316 316" xmlns="http://www.w3.org/2000/svg" {{ $attributes }}>
+ <path d="M305.8 81.125C305.77 80.995 305.69 80.885 305.65 80.755C305.56 80.525 305.49 80.285 305.37 80.075C305.29 79.935 305.17 79.815 305.07 79.685C304.94 79.515 304.83 79.325 304.68 79.175C304.55 79.045 304.39 78.955 304.25 78.845C304.09 78.715 303.95 78.575 303.77 78.475L251.32 48.275C249.97 47.495 248.31 47.495 246.96 48.275L194.51 78.475C194.33 78.575 194.19 78.725 194.03 78.845C193.89 78.955 193.73 79.045 193.6 79.175C193.45 79.325 193.34 79.515 193.21 79.685C193.11 79.815 192.99 79.935 192.91 80.075C192.79 80.285 192.71 80.525 192.63 80.755C192.58 80.875 192.51 80.995 192.48 81.125C192.38 81.495 192.33 81.875 192.33 82.265V139.625L148.62 164.795V52.575C148.62 52.185 148.57 51.805 148.47 51.435C148.44 51.305 148.36 51.195 148.32 51.065C148.23 50.835 148.16 50.595 148.04 50.385C147.96 50.245 147.84 50.125 147.74 49.995C147.61 49.825 147.5 49.635 147.35 49.485C147.22 49.355 147.06 49.265 146.92 49.155C146.76 49.025 146.62 48.885 146.44 48.785L93.99 18.585C92.64 17.805 90.98 17.805 89.63 18.585L37.18 48.785C37 48.885 36.86 49.035 36.7 49.155C36.56 49.265 36.4 49.355 36.27 49.485C36.12 49.635 36.01 49.825 35.88 49.995C35.78 50.125 35.66 50.245 35.58 50.385C35.46 50.595 35.38 50.835 35.3 51.065C35.25 51.185 35.18 51.305 35.15 51.435C35.05 51.805 35 52.185 35 52.575V232.235C35 233.795 35.84 235.245 37.19 236.025L142.1 296.425C142.33 296.555 142.58 296.635 142.82 296.725C142.93 296.765 143.04 296.835 143.16 296.865C143.53 296.965 143.9 297.015 144.28 297.015C144.66 297.015 145.03 296.965 145.4 296.865C145.5 296.835 145.59 296.775 145.69 296.745C145.95 296.655 146.21 296.565 146.45 296.435L251.36 236.035C252.72 235.255 253.55 233.815 253.55 232.245V174.885L303.81 145.945C305.17 145.165 306 143.725 306 142.155V82.265C305.95 81.875 305.89 81.495 305.8 81.125ZM144.2 227.205L100.57 202.515L146.39 176.135L196.66 147.195L240.33 172.335L208.29 190.625L144.2 227.205ZM244.75 114.995V164.795L226.39 154.225L201.03 139.625V89.825L219.39 100.395L244.75 114.995ZM249.12 57.105L292.81 82.265L249.12 107.425L205.43 82.265L249.12 57.105ZM114.49 184.425L96.13 194.995V85.305L121.49 70.705L139.85 60.135V169.815L114.49 184.425ZM91.76 27.425L135.45 52.585L91.76 77.745L48.07 52.585L91.76 27.425ZM43.67 60.135L62.03 70.705L87.39 85.305V202.545V202.555V202.565C87.39 202.735 87.44 202.895 87.46 203.055C87.49 203.265 87.49 203.485 87.55 203.695V203.705C87.6 203.875 87.69 204.035 87.76 204.195C87.84 204.375 87.89 204.575 87.99 204.745C87.99 204.745 87.99 204.755 88 204.755C88.09 204.905 88.22 205.035 88.33 205.175C88.45 205.335 88.55 205.495 88.69 205.635L88.7 205.645C88.82 205.765 88.98 205.855 89.12 205.965C89.28 206.085 89.42 206.225 89.59 206.325C89.6 206.325 89.6 206.325 89.61 206.335C89.62 206.335 89.62 206.345 89.63 206.345L139.87 234.775V285.065L43.67 229.705V60.135ZM244.75 229.705L148.58 285.075V234.775L219.8 194.115L244.75 179.875V229.705ZM297.2 139.625L253.49 164.795V114.995L278.85 100.395L297.21 89.825V139.625H297.2Z"/>
+</svg>
diff --git a/resources/views/components/auth-card.blade.php b/resources/views/components/auth-card.blade.php
new file mode 100644
index 0000000..71235cf
--- /dev/null
+++ b/resources/views/components/auth-card.blade.php
@@ -0,0 +1,9 @@
+<div class="min-h-screen flex flex-col sm:justify-center items-center pt-6 sm:pt-0 bg-gray-100">
+ <div>
+ {{ $logo }}
+ </div>
+
+ <div class="w-full sm:max-w-md mt-6 px-6 py-4 bg-white shadow-md overflow-hidden sm:rounded-lg">
+ {{ $slot }}
+ </div>
+</div>
diff --git a/resources/views/components/auth-session-status.blade.php b/resources/views/components/auth-session-status.blade.php
new file mode 100644
index 0000000..c4bd6e2
--- /dev/null
+++ b/resources/views/components/auth-session-status.blade.php
@@ -0,0 +1,7 @@
+@props(['status'])
+
+@if ($status)
+ <div {{ $attributes->merge(['class' => 'font-medium text-sm text-green-600']) }}>
+ {{ $status }}
+ </div>
+@endif
diff --git a/resources/views/components/auth-validation-errors.blade.php b/resources/views/components/auth-validation-errors.blade.php
new file mode 100644
index 0000000..fc0eaeb
--- /dev/null
+++ b/resources/views/components/auth-validation-errors.blade.php
@@ -0,0 +1,15 @@
+@props(['errors'])
+
+@if ($errors->any())
+ <div {{ $attributes }}>
+ <div class="font-medium text-red-600">
+ {{ __('Whoops! Something went wrong.') }}
+ </div>
+
+ <ul class="mt-3 list-disc list-inside text-sm text-red-600">
+ @foreach ($errors->all() as $error)
+ <li>{{ $error }}</li>
+ @endforeach
+ </ul>
+ </div>
+@endif
diff --git a/resources/views/components/button.blade.php b/resources/views/components/button.blade.php
new file mode 100644
index 0000000..8f18773
--- /dev/null
+++ b/resources/views/components/button.blade.php
@@ -0,0 +1,3 @@
+<button {{ $attributes->merge(['type' => 'submit', 'class' => 'inline-flex items-center px-4 py-2 bg-gray-800 border border-transparent rounded-md font-semibold text-xs text-white uppercase tracking-widest hover:bg-gray-700 active:bg-gray-900 focus:outline-none focus:border-gray-900 focus:ring ring-gray-300 disabled:opacity-25 transition ease-in-out duration-150']) }}>
+ {{ $slot }}
+</button>
diff --git a/resources/views/components/dropdown-link.blade.php b/resources/views/components/dropdown-link.blade.php
new file mode 100644
index 0000000..761ee8a
--- /dev/null
+++ b/resources/views/components/dropdown-link.blade.php
@@ -0,0 +1 @@
+<a {{ $attributes->merge(['class' => 'block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 transition duration-150 ease-in-out']) }}>{{ $slot }}</a>
diff --git a/resources/views/components/dropdown.blade.php b/resources/views/components/dropdown.blade.php
new file mode 100644
index 0000000..c015664
--- /dev/null
+++ b/resources/views/components/dropdown.blade.php
@@ -0,0 +1,43 @@
+@props(['align' => 'right', 'width' => '48', 'contentClasses' => 'py-1 bg-white'])
+
+@php
+switch ($align) {
+ case 'left':
+ $alignmentClasses = 'origin-top-left left-0';
+ break;
+ case 'top':
+ $alignmentClasses = 'origin-top';
+ break;
+ case 'right':
+ default:
+ $alignmentClasses = 'origin-top-right right-0';
+ break;
+}
+
+switch ($width) {
+ case '48':
+ $width = 'w-48';
+ break;
+}
+@endphp
+
+<div class="relative" x-data="{ open: false }" @click.outside="open = false" @close.stop="open = false">
+ <div @click="open = ! open">
+ {{ $trigger }}
+ </div>
+
+ <div x-show="open"
+ x-transition:enter="transition ease-out duration-200"
+ x-transition:enter-start="transform opacity-0 scale-95"
+ x-transition:enter-end="transform opacity-100 scale-100"
+ x-transition:leave="transition ease-in duration-75"
+ x-transition:leave-start="transform opacity-100 scale-100"
+ x-transition:leave-end="transform opacity-0 scale-95"
+ class="absolute z-50 mt-2 {{ $width }} rounded-md shadow-lg {{ $alignmentClasses }}"
+ style="display: none;"
+ @click="open = false">
+ <div class="rounded-md ring-1 ring-black ring-opacity-5 {{ $contentClasses }}">
+ {{ $content }}
+ </div>
+ </div>
+</div>
diff --git a/resources/views/components/input.blade.php b/resources/views/components/input.blade.php
new file mode 100644
index 0000000..d6d857b
--- /dev/null
+++ b/resources/views/components/input.blade.php
@@ -0,0 +1,3 @@
+@props(['disabled' => false])
+
+<input {{ $disabled ? 'disabled' : '' }} {!! $attributes->merge(['class' => 'rounded-md shadow-sm border-gray-300 focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50']) !!}>
diff --git a/resources/views/components/label.blade.php b/resources/views/components/label.blade.php
new file mode 100644
index 0000000..1cc65e2
--- /dev/null
+++ b/resources/views/components/label.blade.php
@@ -0,0 +1,5 @@
+@props(['value'])
+
+<label {{ $attributes->merge(['class' => 'block font-medium text-sm text-gray-700']) }}>
+ {{ $value ?? $slot }}
+</label>
diff --git a/resources/views/components/nav-link.blade.php b/resources/views/components/nav-link.blade.php
new file mode 100644
index 0000000..5c101a2
--- /dev/null
+++ b/resources/views/components/nav-link.blade.php
@@ -0,0 +1,11 @@
+@props(['active'])
+
+@php
+$classes = ($active ?? false)
+ ? 'inline-flex items-center px-1 pt-1 border-b-2 border-indigo-400 text-sm font-medium leading-5 text-gray-900 focus:outline-none focus:border-indigo-700 transition duration-150 ease-in-out'
+ : 'inline-flex items-center px-1 pt-1 border-b-2 border-transparent text-sm font-medium leading-5 text-gray-500 hover:text-gray-700 hover:border-gray-300 focus:outline-none focus:text-gray-700 focus:border-gray-300 transition duration-150 ease-in-out';
+@endphp
+
+<a {{ $attributes->merge(['class' => $classes]) }}>
+ {{ $slot }}
+</a>
diff --git a/resources/views/components/responsive-nav-link.blade.php b/resources/views/components/responsive-nav-link.blade.php
new file mode 100644
index 0000000..02bb527
--- /dev/null
+++ b/resources/views/components/responsive-nav-link.blade.php
@@ -0,0 +1,11 @@
+@props(['active'])
+
+@php
+$classes = ($active ?? false)
+ ? 'block pl-3 pr-4 py-2 border-l-4 border-indigo-400 text-base font-medium text-indigo-700 bg-indigo-50 focus:outline-none focus:text-indigo-800 focus:bg-indigo-100 focus:border-indigo-700 transition duration-150 ease-in-out'
+ : 'block pl-3 pr-4 py-2 border-l-4 border-transparent text-base font-medium text-gray-600 hover:text-gray-800 hover:bg-gray-50 hover:border-gray-300 focus:outline-none focus:text-gray-800 focus:bg-gray-50 focus:border-gray-300 transition duration-150 ease-in-out';
+@endphp
+
+<a {{ $attributes->merge(['class' => $classes]) }}>
+ {{ $slot }}
+</a>
diff --git a/resources/views/dashboard.blade.php b/resources/views/dashboard.blade.php
new file mode 100644
index 0000000..025a79a
--- /dev/null
+++ b/resources/views/dashboard.blade.php
@@ -0,0 +1,17 @@
+<x-app-layout>
+ <x-slot name="header">
+ <h2 class="font-semibold text-xl text-gray-800 leading-tight">
+ {{ __('Dashboard') }}
+ </h2>
+ </x-slot>
+
+ <div class="py-12">
+ <div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
+ <div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
+ <div class="p-6 bg-white border-b border-gray-200">
+ You're logged in!
+ </div>
+ </div>
+ </div>
+ </div>
+</x-app-layout>
diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php
new file mode 100644
index 0000000..e7f54bc
--- /dev/null
+++ b/resources/views/layouts/app.blade.php
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <meta name="csrf-token" content="{{ csrf_token() }}">
+
+ <title>{{ config('app.name', 'Laravel') }}</title>
+
+ <!-- Fonts -->
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap">
+
+ <!-- Styles -->
+ <link rel="stylesheet" href="{{ asset('css/app.css') }}">
+
+ <!-- Scripts -->
+ <script src="{{ asset('js/app.js') }}" defer></script>
+ </head>
+ <body class="font-sans antialiased">
+ <div class="min-h-screen bg-gray-100">
+ @include('layouts.navigation')
+
+ <!-- Page Heading -->
+ <header class="bg-white shadow">
+ <div class="max-w-7xl mx-auto py-6 px-4 sm:px-6 lg:px-8">
+ {{ $header }}
+ </div>
+ </header>
+
+ <!-- Page Content -->
+ <main>
+ {{ $slot }}
+ </main>
+ </div>
+ </body>
+</html>
diff --git a/resources/views/layouts/guest.blade.php b/resources/views/layouts/guest.blade.php
new file mode 100644
index 0000000..b94f3af
--- /dev/null
+++ b/resources/views/layouts/guest.blade.php
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <meta name="csrf-token" content="{{ csrf_token() }}">
+
+ <title>{{ config('app.name', 'Laravel') }}</title>
+
+ <!-- Fonts -->
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap">
+
+ <!-- Styles -->
+ <link rel="stylesheet" href="{{ asset('css/app.css') }}">
+
+ <!-- Scripts -->
+ <script src="{{ asset('js/app.js') }}" defer></script>
+ </head>
+ <body>
+ <div class="font-sans text-gray-900 antialiased">
+ {{ $slot }}
+ </div>
+ </body>
+</html>
diff --git a/resources/views/layouts/navigation.blade.php b/resources/views/layouts/navigation.blade.php
new file mode 100644
index 0000000..4e4c93d
--- /dev/null
+++ b/resources/views/layouts/navigation.blade.php
@@ -0,0 +1,92 @@
+<nav x-data="{ open: false }" class="bg-white border-b border-gray-100">
+ <!-- Primary Navigation Menu -->
+ <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
+ <div class="flex justify-between h-16">
+ <div class="flex">
+ <!-- Logo -->
+ <div class="flex-shrink-0 flex items-center">
+ <a href="{{ route('dashboard') }}">
+ <x-application-logo class="block h-10 w-auto fill-current text-gray-600" />
+ </a>
+ </div>
+
+ <!-- Navigation Links -->
+ <div class="hidden space-x-8 sm:-my-px sm:ml-10 sm:flex">
+ <x-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')">
+ {{ __('Dashboard') }}
+ </x-nav-link>
+ </div>
+ </div>
+
+ <!-- Settings Dropdown -->
+ <div class="hidden sm:flex sm:items-center sm:ml-6">
+ <x-dropdown align="right" width="48">
+ <x-slot name="trigger">
+ <button class="flex items-center text-sm font-medium text-gray-500 hover:text-gray-700 hover:border-gray-300 focus:outline-none focus:text-gray-700 focus:border-gray-300 transition duration-150 ease-in-out">
+ <div>{{ Auth::user()->name }}</div>
+
+ <div class="ml-1">
+ <svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
+ <path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />
+ </svg>
+ </div>
+ </button>
+ </x-slot>
+
+ <x-slot name="content">
+ <!-- Authentication -->
+ <form method="POST" action="{{ route('logout') }}">
+ @csrf
+
+ <x-dropdown-link :href="route('logout')"
+ onclick="event.preventDefault();
+ this.closest('form').submit();">
+ {{ __('Log Out') }}
+ </x-dropdown-link>
+ </form>
+ </x-slot>
+ </x-dropdown>
+ </div>
+
+ <!-- Hamburger -->
+ <div class="-mr-2 flex items-center sm:hidden">
+ <button @click="open = ! open" class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 focus:text-gray-500 transition duration-150 ease-in-out">
+ <svg class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
+ <path :class="{'hidden': open, 'inline-flex': ! open }" class="inline-flex" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
+ <path :class="{'hidden': ! open, 'inline-flex': open }" class="hidden" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
+ </svg>
+ </button>
+ </div>
+ </div>
+ </div>
+
+ <!-- Responsive Navigation Menu -->
+ <div :class="{'block': open, 'hidden': ! open}" class="hidden sm:hidden">
+ <div class="pt-2 pb-3 space-y-1">
+ <x-responsive-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')">
+ {{ __('Dashboard') }}
+ </x-responsive-nav-link>
+ </div>
+
+ <!-- Responsive Settings Options -->
+ <div class="pt-4 pb-1 border-t border-gray-200">
+ <div class="px-4">
+ <div class="font-medium text-base text-gray-800">{{ Auth::user()->name }}</div>
+ <div class="font-medium text-sm text-gray-500">{{ Auth::user()->email }}</div>
+ </div>
+
+ <div class="mt-3 space-y-1">
+ <!-- Authentication -->
+ <form method="POST" action="{{ route('logout') }}">
+ @csrf
+
+ <x-responsive-nav-link :href="route('logout')"
+ onclick="event.preventDefault();
+ this.closest('form').submit();">
+ {{ __('Log Out') }}
+ </x-responsive-nav-link>
+ </form>
+ </div>
+ </div>
+ </div>
+</nav>
diff --git a/resources/views/welcome.blade.php b/resources/views/welcome.blade.php
index dd6a45d..3889977 100644
--- a/resources/views/welcome.blade.php
+++ b/resources/views/welcome.blade.php
@@ -25,7 +25,7 @@
@if (Route::has('login'))
<div class="hidden fixed top-0 right-0 px-6 py-4 sm:block">
@auth
- <a href="{{ url('/home') }}" class="text-sm text-gray-700 dark:text-gray-500 underline">Home</a>
+ <a href="{{ url('/dashboard') }}" class="text-sm text-gray-700 dark:text-gray-500 underline">Dashboard</a>
@else
<a href="{{ route('login') }}" class="text-sm text-gray-700 dark:text-gray-500 underline">Log in</a>
diff --git a/routes/auth.php b/routes/auth.php
new file mode 100644
index 0000000..0fb1129
--- /dev/null
+++ b/routes/auth.php
@@ -0,0 +1,64 @@
+<?php
+
+use App\Http\Controllers\Auth\AuthenticatedSessionController;
+use App\Http\Controllers\Auth\ConfirmablePasswordController;
+use App\Http\Controllers\Auth\EmailVerificationNotificationController;
+use App\Http\Controllers\Auth\EmailVerificationPromptController;
+use App\Http\Controllers\Auth\NewPasswordController;
+use App\Http\Controllers\Auth\PasswordResetLinkController;
+use App\Http\Controllers\Auth\RegisteredUserController;
+use App\Http\Controllers\Auth\VerifyEmailController;
+use Illuminate\Support\Facades\Route;
+
+Route::get('/register', [RegisteredUserController::class, 'create'])
+ ->middleware('guest')
+ ->name('register');
+
+Route::post('/register', [RegisteredUserController::class, 'store'])
+ ->middleware('guest');
+
+Route::get('/login', [AuthenticatedSessionController::class, 'create'])
+ ->middleware('guest')
+ ->name('login');
+
+Route::post('/login', [AuthenticatedSessionController::class, 'store'])
+ ->middleware('guest');
+
+Route::get('/forgot-password', [PasswordResetLinkController::class, 'create'])
+ ->middleware('guest')
+ ->name('password.request');
+
+Route::post('/forgot-password', [PasswordResetLinkController::class, 'store'])
+ ->middleware('guest')
+ ->name('password.email');
+
+Route::get('/reset-password/{token}', [NewPasswordController::class, 'create'])
+ ->middleware('guest')
+ ->name('password.reset');
+
+Route::post('/reset-password', [NewPasswordController::class, 'store'])
+ ->middleware('guest')
+ ->name('password.update');
+
+Route::get('/verify-email', [EmailVerificationPromptController::class, '__invoke'])
+ ->middleware('auth')
+ ->name('verification.notice');
+
+Route::get('/verify-email/{id}/{hash}', [VerifyEmailController::class, '__invoke'])
+ ->middleware(['auth', 'signed', 'throttle:6,1'])
+ ->name('verification.verify');
+
+Route::post('/email/verification-notification', [EmailVerificationNotificationController::class, 'store'])
+ ->middleware(['auth', 'throttle:6,1'])
+ ->name('verification.send');
+
+Route::get('/confirm-password', [ConfirmablePasswordController::class, 'show'])
+ ->middleware('auth')
+ ->name('password.confirm');
+
+Route::post('/confirm-password', [ConfirmablePasswordController::class, 'store'])
+ ->middleware('auth');
+
+Route::post('/logout', [AuthenticatedSessionController::class, 'destroy'])
+ ->middleware('auth')
+ ->name('logout');
diff --git a/routes/web.php b/routes/web.php
index b130397..852b11f 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -16,3 +16,9 @@ use Illuminate\Support\Facades\Route;
Route::get('/', function () {
return view('welcome');
});
+
+Route::get('/dashboard', function () {
+ return view('dashboard');
+})->middleware(['auth'])->name('dashboard');
+
+require __DIR__.'/auth.php';
diff --git a/tailwind.config.js b/tailwind.config.js
new file mode 100644
index 0000000..16ec9c2
--- /dev/null
+++ b/tailwind.config.js
@@ -0,0 +1,25 @@
+const defaultTheme = require('tailwindcss/defaultTheme');
+
+module.exports = {
+ purge: [
+ './vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php',
+ './storage/framework/views/*.php',
+ './resources/views/**/*.blade.php',
+ ],
+
+ theme: {
+ extend: {
+ fontFamily: {
+ sans: ['Nunito', ...defaultTheme.fontFamily.sans],
+ },
+ },
+ },
+
+ variants: {
+ extend: {
+ opacity: ['disabled'],
+ },
+ },
+
+ plugins: [require('@tailwindcss/forms')],
+};
diff --git a/tests/Feature/Auth/AuthenticationTest.php b/tests/Feature/Auth/AuthenticationTest.php
new file mode 100644
index 0000000..075a4c2
--- /dev/null
+++ b/tests/Feature/Auth/AuthenticationTest.php
@@ -0,0 +1,45 @@
+<?php
+
+namespace Tests\Feature\Auth;
+
+use App\Models\User;
+use App\Providers\RouteServiceProvider;
+use Illuminate\Foundation\Testing\RefreshDatabase;
+use Tests\TestCase;
+
+class AuthenticationTest extends TestCase
+{
+ use RefreshDatabase;
+
+ public function test_login_screen_can_be_rendered()
+ {
+ $response = $this->get('/login');
+
+ $response->assertStatus(200);
+ }
+
+ public function test_users_can_authenticate_using_the_login_screen()
+ {
+ $user = User::factory()->create();
+
+ $response = $this->post('/login', [
+ 'email' => $user->email,
+ 'password' => 'password',
+ ]);
+
+ $this->assertAuthenticated();
+ $response->assertRedirect(RouteServiceProvider::HOME);
+ }
+
+ public function test_users_can_not_authenticate_with_invalid_password()
+ {
+ $user = User::factory()->create();
+
+ $this->post('/login', [
+ 'email' => $user->email,
+ 'password' => 'wrong-password',
+ ]);
+
+ $this->assertGuest();
+ }
+}
diff --git a/tests/Feature/Auth/EmailVerificationTest.php b/tests/Feature/Auth/EmailVerificationTest.php
new file mode 100644
index 0000000..e61810e
--- /dev/null
+++ b/tests/Feature/Auth/EmailVerificationTest.php
@@ -0,0 +1,65 @@
+<?php
+
+namespace Tests\Feature\Auth;
+
+use App\Models\User;
+use App\Providers\RouteServiceProvider;
+use Illuminate\Auth\Events\Verified;
+use Illuminate\Foundation\Testing\RefreshDatabase;
+use Illuminate\Support\Facades\Event;
+use Illuminate\Support\Facades\URL;
+use Tests\TestCase;
+
+class EmailVerificationTest extends TestCase
+{
+ use RefreshDatabase;
+
+ public function test_email_verification_screen_can_be_rendered()
+ {
+ $user = User::factory()->create([
+ 'email_verified_at' => null,
+ ]);
+
+ $response = $this->actingAs($user)->get('/verify-email');
+
+ $response->assertStatus(200);
+ }
+
+ public function test_email_can_be_verified()
+ {
+ $user = User::factory()->create([
+ 'email_verified_at' => null,
+ ]);
+
+ Event::fake();
+
+ $verificationUrl = URL::temporarySignedRoute(
+ 'verification.verify',
+ now()->addMinutes(60),
+ ['id' => $user->id, 'hash' => sha1($user->email)]
+ );
+
+ $response = $this->actingAs($user)->get($verificationUrl);
+
+ Event::assertDispatched(Verified::class);
+ $this->assertTrue($user->fresh()->hasVerifiedEmail());
+ $response->assertRedirect(RouteServiceProvider::HOME.'?verified=1');
+ }
+
+ public function test_email_is_not_verified_with_invalid_hash()
+ {
+ $user = User::factory()->create([
+ 'email_verified_at' => null,
+ ]);
+
+ $verificationUrl = URL::temporarySignedRoute(
+ 'verification.verify',
+ now()->addMinutes(60),
+ ['id' => $user->id, 'hash' => sha1('wrong-email')]
+ );
+
+ $this->actingAs($user)->get($verificationUrl);
+
+ $this->assertFalse($user->fresh()->hasVerifiedEmail());
+ }
+}
diff --git a/tests/Feature/Auth/PasswordConfirmationTest.php b/tests/Feature/Auth/PasswordConfirmationTest.php
new file mode 100644
index 0000000..d2072ff
--- /dev/null
+++ b/tests/Feature/Auth/PasswordConfirmationTest.php
@@ -0,0 +1,44 @@
+<?php
+
+namespace Tests\Feature\Auth;
+
+use App\Models\User;
+use Illuminate\Foundation\Testing\RefreshDatabase;
+use Tests\TestCase;
+
+class PasswordConfirmationTest extends TestCase
+{
+ use RefreshDatabase;
+
+ public function test_confirm_password_screen_can_be_rendered()
+ {
+ $user = User::factory()->create();
+
+ $response = $this->actingAs($user)->get('/confirm-password');
+
+ $response->assertStatus(200);
+ }
+
+ public function test_password_can_be_confirmed()
+ {
+ $user = User::factory()->create();
+
+ $response = $this->actingAs($user)->post('/confirm-password', [
+ 'password' => 'password',
+ ]);
+
+ $response->assertRedirect();
+ $response->assertSessionHasNoErrors();
+ }
+
+ public function test_password_is_not_confirmed_with_invalid_password()
+ {
+ $user = User::factory()->create();
+
+ $response = $this->actingAs($user)->post('/confirm-password', [
+ 'password' => 'wrong-password',
+ ]);
+
+ $response->assertSessionHasErrors();
+ }
+}
diff --git a/tests/Feature/Auth/PasswordResetTest.php b/tests/Feature/Auth/PasswordResetTest.php
new file mode 100644
index 0000000..b2cd77a
--- /dev/null
+++ b/tests/Feature/Auth/PasswordResetTest.php
@@ -0,0 +1,71 @@
+<?php
+
+namespace Tests\Feature\Auth;
+
+use App\Models\User;
+use Illuminate\Auth\Notifications\ResetPassword;
+use Illuminate\Foundation\Testing\RefreshDatabase;
+use Illuminate\Support\Facades\Notification;
+use Tests\TestCase;
+
+class PasswordResetTest extends TestCase
+{
+ use RefreshDatabase;
+
+ public function test_reset_password_link_screen_can_be_rendered()
+ {
+ $response = $this->get('/forgot-password');
+
+ $response->assertStatus(200);
+ }
+
+ public function test_reset_password_link_can_be_requested()
+ {
+ Notification::fake();
+
+ $user = User::factory()->create();
+
+ $this->post('/forgot-password', ['email' => $user->email]);
+
+ Notification::assertSentTo($user, ResetPassword::class);
+ }
+
+ public function test_reset_password_screen_can_be_rendered()
+ {
+ Notification::fake();
+
+ $user = User::factory()->create();
+
+ $this->post('/forgot-password', ['email' => $user->email]);
+
+ Notification::assertSentTo($user, ResetPassword::class, function ($notification) {
+ $response = $this->get('/reset-password/'.$notification->token);
+
+ $response->assertStatus(200);
+
+ return true;
+ });
+ }
+
+ public function test_password_can_be_reset_with_valid_token()
+ {
+ Notification::fake();
+
+ $user = User::factory()->create();
+
+ $this->post('/forgot-password', ['email' => $user->email]);
+
+ Notification::assertSentTo($user, ResetPassword::class, function ($notification) use ($user) {
+ $response = $this->post('/reset-password', [
+ 'token' => $notification->token,
+ 'email' => $user->email,
+ 'password' => 'password',
+ 'password_confirmation' => 'password',
+ ]);
+
+ $response->assertSessionHasNoErrors();
+
+ return true;
+ });
+ }
+}
diff --git a/tests/Feature/Auth/RegistrationTest.php b/tests/Feature/Auth/RegistrationTest.php
new file mode 100644
index 0000000..317a827
--- /dev/null
+++ b/tests/Feature/Auth/RegistrationTest.php
@@ -0,0 +1,32 @@
+<?php
+
+namespace Tests\Feature\Auth;
+
+use App\Providers\RouteServiceProvider;
+use Illuminate\Foundation\Testing\RefreshDatabase;
+use Tests\TestCase;
+
+class RegistrationTest extends TestCase
+{
+ use RefreshDatabase;
+
+ public function test_registration_screen_can_be_rendered()
+ {
+ $response = $this->get('/register');
+
+ $response->assertStatus(200);
+ }
+
+ public function test_new_users_can_register()
+ {
+ $response = $this->post('/register', [
+ 'name' => 'Test User',
+ 'email' => 'test@example.com',
+ 'password' => 'password',
+ 'password_confirmation' => 'password',
+ ]);
+
+ $this->assertAuthenticated();
+ $response->assertRedirect(RouteServiceProvider::HOME);
+ }
+}
diff --git a/webpack.mix.js b/webpack.mix.js
index 2a22dc1..c0e99dd 100644
--- a/webpack.mix.js
+++ b/webpack.mix.js
@@ -11,7 +11,8 @@ const mix = require('laravel-mix');
|
*/
-mix.js('resources/js/app.js', 'public/js')
- .postCss('resources/css/app.css', 'public/css', [
- //
- ]);
+mix.js('resources/js/app.js', 'public/js').postCss('resources/css/app.css', 'public/css', [
+ require('postcss-import'),
+ require('tailwindcss'),
+ require('autoprefixer'),
+]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment