PHP code example of gru2007 / filament-jetstream-ru

1. Go to this page and download the library: Download gru2007/filament-jetstream-ru 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/ */

    

gru2007 / filament-jetstream-ru example snippets


use \App\Models\User;
use Filament\Jetstream\JetstreamPlugin;
use Illuminate\Validation\Rules\Password;

...
->plugins([
    ...
    JetstreamPlugin::make()
        ->configureUserModel(userModel: User::class)
        ->profilePhoto(condition: fn() => true, disk: 'public')
        ->deleteAccount(condition: fn() => true)
        ->updatePassword(condition: fn() => true, Password::default())
        ->profileInformation(condition: fn() => true)
        ->logoutBrowserSessions(condition: fn() => true)
        ->twoFactorAuthentication(
            condition: fn() => auth()->check(),
            forced: fn() => app()->isProduction(),
            enablePasskey: fn() =>  Feature::active('passkey'),
            

use \Filament\Jetstream\Role;
use Filament\Jetstream\JetstreamPlugin;
use Illuminate\Validation\Rules\Password;
use \Filament\Jetstream\Models\{Team,Membership,TeamInvitation};

...
->plugins([
    ...
    JetstreamPlugin::make()
        ->teams(
            condition: fn() => Feature::active('teams'), 
            acceptTeamInvitation: fn($invitationId) => JetstreamPlugin::make()->defaultAcceptTeamInvitation()
        )
        ->configureTeamModels(
            teamModel: Team::class,
            roleModel: Role::class,
            membershipModel: Membership::class,
            teamInvitationModel:  TeamInvitation::class
        ),
])

use Filament\Jetstream\JetstreamPlugin;
use Illuminate\Validation\Rules\Password;
use \Filament\Jetstream\Role;
use \Filament\Jetstream\Models\{Team, Membership, TeamInvitation};

...
->plugins([
    ...
    JetstreamPlugin::make()
        ->apiTokens(
            condition: fn() => Feature::active('api'), 
            permissions: fn() => ['create', 'read', 'update', 'delete'],
            menuItemLabel: fn() => 'API Tokens',
            menuItemIcon: fn() => 'heroicon-o-key',
        ),
])

...
use Filament\Jetstream\HasProfilePhoto;
use Filament\Models\Contracts\HasAvatar;
use Spatie\LaravelPasskeys\Models\Concerns\HasPasskeys;
use \Filament\Jetstream\InteractsWIthProfile;

class User extends Authenticatable implements  HasAvatar, HasPasskeys
{
    ...
    use InteractsWIthProfile;

    protected $hidden = [
        ...
        'two_factor_recovery_codes',
        'two_factor_secret',
    ];

    protected $appends = [
        ...
        'profile_photo_url',
    ];
}

...
use Filament\Jetstream\InteractsWithTeams;
use Filament\Models\Contracts\HasTenants;

class User extends Authenticatable implements  HasTenants
{
    ...
    use InteractsWithTeams;
}


...
use \Laravel\Sanctum\HasApiTokens;

class User extends Authenticatable 
{
    use HasApiTokens;
}

bash
php artisan vendor:publish --tag=filament-jetstream-team-migration
bash
php artisan vendor:publish --tag=filament-jetstream-team-migration