From f5664ce84b0a4d7b3caa076145d65a49e05881d8 Mon Sep 17 00:00:00 2001 From: "Edward Tirado Jr." Date: Sun, 14 Dec 2025 13:23:46 -0600 Subject: [PATCH] fixed user registration issue --- app/Livewire/Auth/RegisterUser.php | 3 +- config/fortify.php | 4 +- config/livewire.php | 173 ++++++++++++++++++ .../0001_01_01_000000_create_users_table.php | 2 +- resources/js/app.js | 1 + resources/views/components/head.blade.php | 1 + .../views/components/layouts/auth.blade.php | 2 +- resources/views/pages/auth/register.blade.php | 45 +++-- routes/web.php | 2 +- 9 files changed, 203 insertions(+), 30 deletions(-) create mode 100644 config/livewire.php diff --git a/app/Livewire/Auth/RegisterUser.php b/app/Livewire/Auth/RegisterUser.php index d7600de..505c642 100644 --- a/app/Livewire/Auth/RegisterUser.php +++ b/app/Livewire/Auth/RegisterUser.php @@ -33,6 +33,7 @@ class RegisterUser extends Component public function render() { - return view('pages.auth.register'); + return view('pages.auth.register') + ->layout('components.layouts.auth'); } } diff --git a/config/fortify.php b/config/fortify.php index a0d6f4f..4a87a1f 100644 --- a/config/fortify.php +++ b/config/fortify.php @@ -130,7 +130,7 @@ return [ | */ - 'views' => true, + 'views' => false, /* |-------------------------------------------------------------------------- @@ -144,7 +144,7 @@ return [ */ 'features' => [ - Features::registration(), + // Features::registration(), Features::resetPasswords(), Features::emailVerification(), Features::twoFactorAuthentication([ diff --git a/config/livewire.php b/config/livewire.php new file mode 100644 index 0000000..8a4be98 --- /dev/null +++ b/config/livewire.php @@ -0,0 +1,173 @@ + 'App\\Livewire', + + /* + |--------------------------------------------------------------------------- + | View Path + |--------------------------------------------------------------------------- + | + | This value is used to specify where Livewire component Blade templates are + | stored when running file creation commands like `artisan make:livewire`. + | It is also used if you choose to omit a component's render() method. + | + */ + + 'view_path' => resource_path('views/livewire'), + + /* + |--------------------------------------------------------------------------- + | Layout + |--------------------------------------------------------------------------- + | The view that will be used as the layout when rendering a single component + | as an entire page via `Route::get('/post/create', CreatePost::class);`. + | In this case, the view returned by CreatePost will render into $slot. + | + */ + + 'layout' => 'components.layouts.app', + + /* + |--------------------------------------------------------------------------- + | Lazy Loading Placeholder + |--------------------------------------------------------------------------- + | Livewire allows you to lazy load components that would otherwise slow down + | the initial page load. Every component can have a custom placeholder or + | you can define the default placeholder view for all components below. + | + */ + + 'lazy_placeholder' => null, + + /* + |--------------------------------------------------------------------------- + | Temporary File Uploads + |--------------------------------------------------------------------------- + | + | Livewire handles file uploads by storing uploads in a temporary directory + | before the file is stored permanently. All file uploads are directed to + | a global endpoint for temporary storage. You may configure this below: + | + */ + + 'temporary_file_upload' => [ + 'disk' => null, // Example: 'local', 's3' | Default: 'default' + 'rules' => null, // Example: ['file', 'mimes:png,jpg'] | Default: ['required', 'file', 'max:12288'] (12MB) + 'directory' => null, // Example: 'tmp' | Default: 'livewire-tmp' + 'middleware' => null, // Example: 'throttle:5,1' | Default: 'throttle:60,1' + 'preview_mimes' => [ // Supported file types for temporary pre-signed file URLs... + 'png', + 'gif', + 'bmp', + 'svg', + 'wav', + 'mp4', + 'mov', + 'avi', + 'wmv', + 'mp3', + 'm4a', + 'jpg', + 'jpeg', + 'mpga', + 'webp', + 'wma', + ], + 'max_upload_time' => 5, // Max duration (in minutes) before an upload is invalidated... + 'cleanup' => true, // Should cleanup temporary uploads older than 24 hrs... + ], + + /* + |--------------------------------------------------------------------------- + | Render On Redirect + |--------------------------------------------------------------------------- + | + | This value determines if Livewire will run a component's `render()` method + | after a redirect has been triggered using something like `redirect(...)` + | Setting this to true will render the view once more before redirecting + | + */ + + 'render_on_redirect' => false, + + /* + |--------------------------------------------------------------------------- + | Eloquent Model Binding + |--------------------------------------------------------------------------- + | + | Previous versions of Livewire supported binding directly to eloquent model + | properties using wire:model by default. However, this behavior has been + | deemed too "magical" and has therefore been put under a feature flag. + | + */ + + 'legacy_model_binding' => false, + + /* + |--------------------------------------------------------------------------- + | Auto-inject Frontend Assets + |--------------------------------------------------------------------------- + | + | By default, Livewire automatically injects its JavaScript and CSS into the + | and of pages containing Livewire components. By disabling + | this behavior, you need to use @livewireStyles and @livewireScripts. + | + */ + + 'inject_assets' => true, + + /* + |--------------------------------------------------------------------------- + | Navigate (SPA mode) + |--------------------------------------------------------------------------- + | + | By adding `wire:navigate` to links in your Livewire application, Livewire + | will prevent the default link handling and instead request those pages + | via AJAX, creating an SPA-like effect. Configure this behavior here. + | + */ + + 'navigate' => [ + 'show_progress_bar' => true, + 'progress_bar_color' => '#2299dd', + ], + + /* + |--------------------------------------------------------------------------- + | HTML Morph Markers + |--------------------------------------------------------------------------- + | + | Livewire intelligently "morphs" existing HTML into the newly rendered HTML + | after each update. To make this process more reliable, Livewire injects + | "markers" into the rendered Blade surrounding @if, @class & @foreach. + | + */ + + 'inject_morph_markers' => true, + + /* + |--------------------------------------------------------------------------- + | Pagination Theme + |--------------------------------------------------------------------------- + | + | When enabling Livewire's pagination feature by using the `WithPagination` + | trait, Livewire will use Tailwind templates to render pagination views + | on the page. If you want Bootstrap CSS, you can specify: "bootstrap" + | + */ + + 'pagination_theme' => 'tailwind', +]; diff --git a/database/migrations/0001_01_01_000000_create_users_table.php b/database/migrations/0001_01_01_000000_create_users_table.php index 705bddf..847d71c 100644 --- a/database/migrations/0001_01_01_000000_create_users_table.php +++ b/database/migrations/0001_01_01_000000_create_users_table.php @@ -12,7 +12,7 @@ return new class extends Migration { { Schema::create('users', function (Blueprint $table) { $table->id(); - $table->string('username'); + $table->string('username')->unique(); $table->string('email')->unique(); $table->timestamp('email_verified_at')->nullable(); $table->string('password')->nullable(); diff --git a/resources/js/app.js b/resources/js/app.js index e69de29..8b13789 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -0,0 +1 @@ + diff --git a/resources/views/components/head.blade.php b/resources/views/components/head.blade.php index 3f61fd9..de59dc3 100644 --- a/resources/views/components/head.blade.php +++ b/resources/views/components/head.blade.php @@ -3,4 +3,5 @@ {{ $title ?? 'Movie Night' }} @vite(['resources/css/app.css', 'resources/js/app.js']) + @livewireStyles diff --git a/resources/views/components/layouts/auth.blade.php b/resources/views/components/layouts/auth.blade.php index 04a3177..69707fe 100644 --- a/resources/views/components/layouts/auth.blade.php +++ b/resources/views/components/layouts/auth.blade.php @@ -3,6 +3,6 @@ {{ $slot }} -@livewireScriptConfig +@livewireScripts diff --git a/resources/views/pages/auth/register.blade.php b/resources/views/pages/auth/register.blade.php index 84b9c00..c48b722 100644 --- a/resources/views/pages/auth/register.blade.php +++ b/resources/views/pages/auth/register.blade.php @@ -1,26 +1,23 @@ - -
-

Create Account

+
+

Create Account

-
- @csrf - @if($errors->any()) -
- @foreach($errors->all() as $error) -

{{$error}}

- @endforeach -
- @endif + + @if($errors->any()) +
+ @foreach($errors->all() as $error) +

{{$error}}

+ @endforeach +
+ @endif -
- - -
-
- - -
- -
-
- +
+ + +
+
+ + +
+ + +
diff --git a/routes/web.php b/routes/web.php index 167356e..8bba99c 100644 --- a/routes/web.php +++ b/routes/web.php @@ -11,7 +11,7 @@ Route::get('/register', RegisterUser::class)->name('register'); Route::get('/reset-password/{token}', PasswordReset::class)->name('reset-password'); -Route::view('/', 'pages.auth.login'); +Route::view('/login', 'pages.auth.login')->name('login'); /* AUTH */ Route::middleware(['auth'])->group(function () {