PHP code example of wychoong / filament-fortify

1. Go to this page and download the library: Download wychoong/filament-fortify library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

wychoong / filament-fortify example snippets


config([
    ## override filament login page
    'filament.auth.pages.login' => Auth\Login::class,
    ## force fortify view enabled
    'fortify.views' => true,
    ## force fortify to use filament home_url
    'fortify.home' => config('filament.home_url'),
]);

'middleware' => [
    'auth' => [
        // ...
        'verified'
    ],
    // ...
]

## update your User model

use Illuminate\Contracts\Auth\MustVerifyEmail;

class User extends Authenticatable implements FilamentUser, MustVerifyEmail
{
    // ...
}

protected static string | array $middlewares = ['password.confirm'];

use Laravel\Fortify\TwoFactorAuthenticatable;

class User extends Authenticatable implements FilamentUser
{
    // ...
    use TwoFactorAuthenticatable;
    // ...
}

use WyChoong\FilamentFortify\Facades\FilamentFortify;

public function boot()
{
    FilamentFortify::navigationGroup(__('your-nav-group'));
    FilamentFortify::navigationLabel(__('your-nav-label'));
    FilamentFortify::pageTitle(__('your-page-title'));
}

    'register-page' => false,

# config/filament-fortify.php
use App\Http\Livewire\Login;

return [
    // ...
    'auth' => [
        'login' =>  Login::class,
        // ...
    ],
    // ...
];

# app/Http/Livewire/Login.php
namespace App\Http\Livewire\Auth;

use WyChoong\FilamentFortify\Http\Livewire\Auth\Login as BaseLogin;

class Login extends BaseLogin{
    
    protected function getFormSchema(): array
    {
        return [
            // your form schema
        ];
    }
}

use Filament\Http\Middleware\DispatchServingFilamentEvent;

return [
    // ...
    'middleware' => ['web', DispatchServingFilamentEvent::class],
    //...
];

## in Service Provider file
public function boot()
{
    Filament::registerRenderHook(
        'filament-fortify.login.end',
        fn (): string => Blade::render('@livewire(\'filament-socialite.buttons\')'),
    );
}
bash
php artisan filament-fortify:install 
php artisan migrate
bash
php artisan vendor:publish --tag="filament-fortify-config"
bash
php artisan vendor:publish --tag="filament-fortify-views"