PHP code example of timo-de-winter / filament-authorization
1. Go to this page and download the library: Download timo-de-winter/filament-authorization 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/ */
timo-de-winter / filament-authorization example snippets
use TimoDeWinter\FilamentAuthorization\Filament\Resources\Roles\RoleResource;
$panel
->plugin(
\TimoDeWinter\FilamentAuthorization\FilamentAuthorizationPlugin::make()
->roleResource([
RoleResource::make('custom')->slug('custom-roles'),
]),
);
// This is the most simple way to do it
\TimoDeWinter\FilamentAuthorization\Facades\FilamentAuthorization::registerPermission(
permission: [
'view' => __('filament-authorization::labels.view'),
'update' => __('filament-authorization::labels.update'),
'create' => __('filament-authorization::labels.create'),
'delete' => __('filament-authorization::labels.delete'),
],
prefix: 'roles',
prefixTranslation: __('filament-authorization::labels.roles'),
tab: 'Authorization', // Optional (defaults to "Default")
);