PHP code example of yebor974 / filament-renew-password

1. Go to this page and download the library: Download yebor974/filament-renew-password 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/ */

    

yebor974 / filament-renew-password example snippets


use Yebor974\Filament\RenewPassword\RenewPasswordPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
       ->plugin(new RenewPasswordPlugin());
}

RenewPasswordPlugin::make()
    ->passwordExpiresIn(days: 30)

RenewPasswordPlugin::make()
    ->passwordExpiresIn(days: 30)
    ->timestampColumn('your_custom_timestamp_column')

RenewPasswordPlugin::make()
    ->forceRenewPassword()

RenewPasswordPlugin::make()
    ->forceRenewPassword(forceRenewColumn: 'your_custom_boolean_force_column')

RenewPasswordPlugin::make()
    ->forceRenewPassword()
    ->timestampColumn('your_custom_timestamp_column')

RenewPasswordPlugin::make()
    ->passwordExpiresIn(days: 30)
    ->forceRenewPassword()

RenewPasswordPlugin::make()
    ->passwordExpiresIn(days: 30)
    ->forceRenewPassword(forceRenewColumn: 'your_custom_boolean_force_column')
    ->timestampColumn('your_custom_timestamp_column')

RenewPasswordPlugin::make()
    ->renewPage(CustomRenewPassword::class)

RenewPasswordPlugin::make()
    ->routeUri('wachtwoord/vernieuwen')

class User extends Authenticatable implements RenewPasswordContract
{
    use RenewPassword;
}

public function needRenewPassword(): bool
{
    $plugin = RenewPasswordPlugin::get();

    return
        (
            !is_null($plugin->getPasswordExpiresIn())
            && Carbon::parse($this->{$plugin->getTimestampColumn()})->addDays($plugin->getPasswordExpiresIn()) < now()
        ) || (
            $plugin->getForceRenewPassword()
            && $this->{$plugin->getForceRenewColumn()}
        );
}

RenewPasswordPlugin::make()
    ->passwordExpiresIn(days: 30)

$table->boolean('force_renew_password')->default(false);
bash
php artisan vendor:publish --tag="filament-renew-password-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="filament-renew-password-translations"