diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 79157b074..b241ba2ef 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -16,7 +16,7 @@ jobs: strategy: fail-fast: true matrix: - stack: [blade, livewire, react, vue, api] + stack: [blade, livewire, livewire-functional, react, vue, api] laravel: [10] args: ["", --pest] include: diff --git a/src/Console/InstallCommand.php b/src/Console/InstallCommand.php index d71116c8e..bd6f8f63b 100644 --- a/src/Console/InstallCommand.php +++ b/src/Console/InstallCommand.php @@ -26,7 +26,7 @@ class InstallCommand extends Command implements PromptsForMissingInput * * @var string */ - protected $signature = 'breeze:install {stack : The development stack that should be installed (blade,livewire,react,vue,api)} + protected $signature = 'breeze:install {stack : The development stack that should be installed (blade,livewire,livewire-functional,react,vue,api)} {--dark : Indicate that dark mode support should be installed} {--pest : Indicate that Pest should be installed} {--ssr : Indicates if Inertia SSR support should be installed} @@ -57,9 +57,11 @@ public function handle() return $this->installBladeStack(); } elseif ($this->argument('stack') === 'livewire') { return $this->installLivewireStack(); + } elseif ($this->argument('stack') === 'livewire-functional') { + return $this->installLivewireStack(true); } - $this->components->error('Invalid stack. Supported stacks are [blade], [livewire], [react], [vue], and [api].'); + $this->components->error('Invalid stack. Supported stacks are [blade], [livewire], [livewire-functional], [react], [vue], and [api].'); return 1; } @@ -75,7 +77,8 @@ protected function installTests() $stubStack = match ($this->argument('stack')) { 'api' => 'api', - 'livewire' => 'livewire', + 'livewire' => 'livewire-common', + 'livewire-functional' => 'livewire-common', default => 'default', }; @@ -314,7 +317,8 @@ protected function promptForMissingArgumentsUsing() label: 'Which Breeze stack would you like to install?', options: [ 'blade' => 'Blade with Alpine', - 'livewire' => 'Livewire with Alpine', + 'livewire' => 'Livewire (Volt Class API) with Alpine', + 'livewire-functional' => 'Livewire (Volt Functional API) with Alpine', 'react' => 'React with Inertia', 'vue' => 'Vue with Inertia', 'api' => 'API only', @@ -343,7 +347,7 @@ protected function afterPromptingForMissingArguments(InputInterface $input, Outp 'typescript' => 'TypeScript (experimental)', ] ))->each(fn ($option) => $input->setOption($option, true)); - } elseif (in_array($stack, ['blade', 'livewire'])) { + } elseif (in_array($stack, ['blade', 'livewire', 'livewire-functional'])) { $input->setOption('dark', confirm( label: 'Would you like dark mode support?', default: false diff --git a/src/Console/InstallsLivewireStack.php b/src/Console/InstallsLivewireStack.php index 525b307e0..19114c89e 100644 --- a/src/Console/InstallsLivewireStack.php +++ b/src/Console/InstallsLivewireStack.php @@ -13,7 +13,7 @@ trait InstallsLivewireStack * * @return int|null */ - protected function installLivewireStack() + protected function installLivewireStack($functional = false) { // NPM Packages... $this->updateNodePackages(function ($packages) { @@ -44,16 +44,22 @@ protected function installLivewireStack() // Views... (new Filesystem)->ensureDirectoryExists(resource_path('views')); - (new Filesystem)->copyDirectory(__DIR__.'/../../stubs/livewire/resources/views', resource_path('views')); + (new Filesystem)->copyDirectory(__DIR__.'/../../stubs/livewire-common/resources/views', resource_path('views')); + + // Livewire Components... + (new Filesystem)->ensureDirectoryExists(resource_path('views/livewire')); + (new Filesystem)->copyDirectory(__DIR__.'/../../stubs/' + .($functional ? 'livewire-functional' : 'livewire') + .'/resources/views/livewire', resource_path('views/livewire')); // Views Components... (new Filesystem)->ensureDirectoryExists(resource_path('views/components')); (new Filesystem)->copyDirectory(__DIR__.'/../../stubs/default/resources/views/components', resource_path('views/components')); - (new Filesystem)->copyDirectory(__DIR__.'/../../stubs/livewire/resources/views/components', resource_path('views/components')); + (new Filesystem)->copyDirectory(__DIR__.'/../../stubs/livewire-common/resources/views/components', resource_path('views/components')); // Views Layouts... (new Filesystem)->ensureDirectoryExists(resource_path('views/layouts')); - (new Filesystem)->copyDirectory(__DIR__.'/../../stubs/livewire/resources/views/layouts', resource_path('views/layouts')); + (new Filesystem)->copyDirectory(__DIR__.'/../../stubs/livewire-common/resources/views/layouts', resource_path('views/layouts')); // Components... (new Filesystem)->ensureDirectoryExists(app_path('View/Components')); @@ -74,8 +80,8 @@ protected function installLivewireStack() } // Routes... - copy(__DIR__.'/../../stubs/livewire/routes/web.php', base_path('routes/web.php')); - copy(__DIR__.'/../../stubs/livewire/routes/auth.php', base_path('routes/auth.php')); + copy(__DIR__.'/../../stubs/livewire-common/routes/web.php', base_path('routes/web.php')); + copy(__DIR__.'/../../stubs/livewire-common/routes/auth.php', base_path('routes/auth.php')); // "Dashboard" Route... $this->replaceInFile('/home', '/dashboard', app_path('Providers/RouteServiceProvider.php')); diff --git a/stubs/livewire/pest-tests/Feature/Auth/AuthenticationTest.php b/stubs/livewire-common/pest-tests/Feature/Auth/AuthenticationTest.php similarity index 100% rename from stubs/livewire/pest-tests/Feature/Auth/AuthenticationTest.php rename to stubs/livewire-common/pest-tests/Feature/Auth/AuthenticationTest.php diff --git a/stubs/livewire/pest-tests/Feature/Auth/EmailVerificationTest.php b/stubs/livewire-common/pest-tests/Feature/Auth/EmailVerificationTest.php similarity index 100% rename from stubs/livewire/pest-tests/Feature/Auth/EmailVerificationTest.php rename to stubs/livewire-common/pest-tests/Feature/Auth/EmailVerificationTest.php diff --git a/stubs/livewire/pest-tests/Feature/Auth/PasswordConfirmationTest.php b/stubs/livewire-common/pest-tests/Feature/Auth/PasswordConfirmationTest.php similarity index 100% rename from stubs/livewire/pest-tests/Feature/Auth/PasswordConfirmationTest.php rename to stubs/livewire-common/pest-tests/Feature/Auth/PasswordConfirmationTest.php diff --git a/stubs/livewire/pest-tests/Feature/Auth/PasswordResetTest.php b/stubs/livewire-common/pest-tests/Feature/Auth/PasswordResetTest.php similarity index 100% rename from stubs/livewire/pest-tests/Feature/Auth/PasswordResetTest.php rename to stubs/livewire-common/pest-tests/Feature/Auth/PasswordResetTest.php diff --git a/stubs/livewire/pest-tests/Feature/Auth/PasswordUpdateTest.php b/stubs/livewire-common/pest-tests/Feature/Auth/PasswordUpdateTest.php similarity index 100% rename from stubs/livewire/pest-tests/Feature/Auth/PasswordUpdateTest.php rename to stubs/livewire-common/pest-tests/Feature/Auth/PasswordUpdateTest.php diff --git a/stubs/livewire/pest-tests/Feature/Auth/RegistrationTest.php b/stubs/livewire-common/pest-tests/Feature/Auth/RegistrationTest.php similarity index 100% rename from stubs/livewire/pest-tests/Feature/Auth/RegistrationTest.php rename to stubs/livewire-common/pest-tests/Feature/Auth/RegistrationTest.php diff --git a/stubs/livewire/pest-tests/Feature/ExampleTest.php b/stubs/livewire-common/pest-tests/Feature/ExampleTest.php similarity index 100% rename from stubs/livewire/pest-tests/Feature/ExampleTest.php rename to stubs/livewire-common/pest-tests/Feature/ExampleTest.php diff --git a/stubs/livewire/pest-tests/Feature/ProfileTest.php b/stubs/livewire-common/pest-tests/Feature/ProfileTest.php similarity index 100% rename from stubs/livewire/pest-tests/Feature/ProfileTest.php rename to stubs/livewire-common/pest-tests/Feature/ProfileTest.php diff --git a/stubs/livewire/pest-tests/Pest.php b/stubs/livewire-common/pest-tests/Pest.php similarity index 100% rename from stubs/livewire/pest-tests/Pest.php rename to stubs/livewire-common/pest-tests/Pest.php diff --git a/stubs/livewire/pest-tests/Unit/ExampleTest.php b/stubs/livewire-common/pest-tests/Unit/ExampleTest.php similarity index 100% rename from stubs/livewire/pest-tests/Unit/ExampleTest.php rename to stubs/livewire-common/pest-tests/Unit/ExampleTest.php diff --git a/stubs/livewire/resources/views/components/action-message.blade.php b/stubs/livewire-common/resources/views/components/action-message.blade.php similarity index 100% rename from stubs/livewire/resources/views/components/action-message.blade.php rename to stubs/livewire-common/resources/views/components/action-message.blade.php diff --git a/stubs/livewire/resources/views/dashboard.blade.php b/stubs/livewire-common/resources/views/dashboard.blade.php similarity index 100% rename from stubs/livewire/resources/views/dashboard.blade.php rename to stubs/livewire-common/resources/views/dashboard.blade.php diff --git a/stubs/livewire/resources/views/layouts/app.blade.php b/stubs/livewire-common/resources/views/layouts/app.blade.php similarity index 100% rename from stubs/livewire/resources/views/layouts/app.blade.php rename to stubs/livewire-common/resources/views/layouts/app.blade.php diff --git a/stubs/livewire/resources/views/layouts/guest.blade.php b/stubs/livewire-common/resources/views/layouts/guest.blade.php similarity index 100% rename from stubs/livewire/resources/views/layouts/guest.blade.php rename to stubs/livewire-common/resources/views/layouts/guest.blade.php diff --git a/stubs/livewire/resources/views/profile.blade.php b/stubs/livewire-common/resources/views/profile.blade.php similarity index 100% rename from stubs/livewire/resources/views/profile.blade.php rename to stubs/livewire-common/resources/views/profile.blade.php diff --git a/stubs/livewire/resources/views/welcome.blade.php b/stubs/livewire-common/resources/views/welcome.blade.php similarity index 100% rename from stubs/livewire/resources/views/welcome.blade.php rename to stubs/livewire-common/resources/views/welcome.blade.php diff --git a/stubs/livewire/routes/auth.php b/stubs/livewire-common/routes/auth.php similarity index 100% rename from stubs/livewire/routes/auth.php rename to stubs/livewire-common/routes/auth.php diff --git a/stubs/livewire/routes/web.php b/stubs/livewire-common/routes/web.php similarity index 100% rename from stubs/livewire/routes/web.php rename to stubs/livewire-common/routes/web.php diff --git a/stubs/livewire/tests/Feature/Auth/AuthenticationTest.php b/stubs/livewire-common/tests/Feature/Auth/AuthenticationTest.php similarity index 100% rename from stubs/livewire/tests/Feature/Auth/AuthenticationTest.php rename to stubs/livewire-common/tests/Feature/Auth/AuthenticationTest.php diff --git a/stubs/livewire/tests/Feature/Auth/EmailVerificationTest.php b/stubs/livewire-common/tests/Feature/Auth/EmailVerificationTest.php similarity index 100% rename from stubs/livewire/tests/Feature/Auth/EmailVerificationTest.php rename to stubs/livewire-common/tests/Feature/Auth/EmailVerificationTest.php diff --git a/stubs/livewire/tests/Feature/Auth/PasswordConfirmationTest.php b/stubs/livewire-common/tests/Feature/Auth/PasswordConfirmationTest.php similarity index 100% rename from stubs/livewire/tests/Feature/Auth/PasswordConfirmationTest.php rename to stubs/livewire-common/tests/Feature/Auth/PasswordConfirmationTest.php diff --git a/stubs/livewire/tests/Feature/Auth/PasswordResetTest.php b/stubs/livewire-common/tests/Feature/Auth/PasswordResetTest.php similarity index 100% rename from stubs/livewire/tests/Feature/Auth/PasswordResetTest.php rename to stubs/livewire-common/tests/Feature/Auth/PasswordResetTest.php diff --git a/stubs/livewire/tests/Feature/Auth/PasswordUpdateTest.php b/stubs/livewire-common/tests/Feature/Auth/PasswordUpdateTest.php similarity index 100% rename from stubs/livewire/tests/Feature/Auth/PasswordUpdateTest.php rename to stubs/livewire-common/tests/Feature/Auth/PasswordUpdateTest.php diff --git a/stubs/livewire/tests/Feature/Auth/RegistrationTest.php b/stubs/livewire-common/tests/Feature/Auth/RegistrationTest.php similarity index 100% rename from stubs/livewire/tests/Feature/Auth/RegistrationTest.php rename to stubs/livewire-common/tests/Feature/Auth/RegistrationTest.php diff --git a/stubs/livewire/tests/Feature/ProfileTest.php b/stubs/livewire-common/tests/Feature/ProfileTest.php similarity index 100% rename from stubs/livewire/tests/Feature/ProfileTest.php rename to stubs/livewire-common/tests/Feature/ProfileTest.php diff --git a/stubs/livewire-functional/resources/views/livewire/layout/navigation.blade.php b/stubs/livewire-functional/resources/views/livewire/layout/navigation.blade.php new file mode 100644 index 000000000..747e58285 --- /dev/null +++ b/stubs/livewire-functional/resources/views/livewire/layout/navigation.blade.php @@ -0,0 +1,105 @@ +guard('web')->logout(); + + session()->invalidate(); + session()->regenerateToken(); + + $this->redirect('/', navigate: true); +}; + +?> + + diff --git a/stubs/livewire-functional/resources/views/livewire/pages/auth/confirm-password.blade.php b/stubs/livewire-functional/resources/views/livewire/pages/auth/confirm-password.blade.php new file mode 100644 index 000000000..2f4c0015f --- /dev/null +++ b/stubs/livewire-functional/resources/views/livewire/pages/auth/confirm-password.blade.php @@ -0,0 +1,64 @@ + '']); + +rules(['password' => ['required', 'string']]); + +$confirmPassword = function () { + $this->validate(); + + if (! auth()->guard('web')->validate([ + 'email' => auth()->user()->email, + 'password' => $this->password, + ])) { + throw ValidationException::withMessages([ + 'password' => __('auth.password'), + ]); + } + + session(['auth.password_confirmed_at' => time()]); + + $this->redirect( + session('url.intended', RouteServiceProvider::HOME), + navigate: true + ); +}; + +?> + +
+ {{ __('Once your account is deleted, all of its resources and data will be permanently deleted. Before deleting your account, please download any data or information that you wish to retain.') }} +
++ {{ __('Ensure your account is using a long, random password to stay secure.') }} +
++ {{ __("Update your account's profile information and email address.") }} +
+{{ __('Your email address is unverified.') }}