PHP code example of mei-labs / filament-renew-password

1. Go to this page and download the library: Download mei-labs/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/ */

    

mei-labs / filament-renew-password example snippets


use MeiLABS\Filament\RenewPassword\RenewPasswordPlugin;

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


// app/Providers/Filament/YourPanelServiceProvider.php

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

// config/filament-renew-password.php

return [
    'timestamp_column' => 'password_changed_at',
    'password_expires_in' => 30,
];


class User extends Authenticatable implements RenewPasswordContract
{
    ... 
    
    public function needRenewPassword(): bool
    {
        return Carbon::parse($this->last_renew_password_at ?? $this->created_at)->addDays(90) < now();
    }
}

class User extends Authenticatable implements RenewPasswordContract
{
    use RenewPassword;
}
bash
php artisan vendor:publish
php artisan migrate