Users Roles Permissions
User and role & permissions management.
Author:
CWSPS154
Documentation

Filament User & Roles & Permissions for Filament v4.
#Requirements
- PHP 8.2+
- Laravel 10.0+
- Filament 4.0+
#Installation
Install Using Composer
composer require cwsps154/users-roles-permissions
#Usage/Examples
Add this into your Filament PannelProvider class panel()
use CWSPS154\UsersRolesPermissions\UsersRolesPermissionsPlugin;
$panel->databaseNotifications() //need to see the export files for the permission
->databaseTransactions() //optional
->plugins([UsersRolesPermissionsPlugin::make()]); //required to enable this extension
You can also update UserResource using setUserResource(UserResource::class) in the plugin
use CWSPS154\UsersRolesPermissions\UsersRolesPermissionsPlugin;
$panel->plugins([UsersRolesPermissionsPlugin::make()->setUserResource(UserResource::class)]);
You can create custom UserResource and extend CWSPS154\UsersRolesPermissions\Filament\Clusters\UserManager\Resources\UserResource as CoreUserResource
Add the CWSPS154\UsersRolesPermissions\Models\HasRole trait in User Model
use HasRole;
And the User model should implements these interfaces's Spatie\MediaLibrary\HasMedia, Filament\Models\Contracts\HasAvatar and Filament\Models\Contracts\FilamentUser
implements HasMedia, HasAvatar, FilamentUser
Also don't forget add these in you User model
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'email',
'mobile',
'password',
'role_id',
'last_seen',
'is_active'
];
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
'last_seen' => 'datetime',
'is_active' => 'boolean',
];
}
Run
# for laravel 11
php artisan make:queue-batches-table
php artisan make:notifications-table //ensure these queues and notifications migrates are published
# for laravel 10
php artisan queue:batches-table
php artisan notifications:table
# for both
php artisan vendor:publish --tag=filament-actions-migrations //publish filament import and export migrations
php artisan vendor:publish --provider="Spatie\MediaLibrary\MediaLibraryServiceProvider" --tag="medialibrary-migrations" //publish spatie media provider
php artisan users-roles-permissions:install
php artisan filament:assets
By default, you will get the user which have email admin@gmail.com & password admin@123.
Note: For the user which is_admin user have all permission by default.
You can publish the config file users-roles-permissions.php, by running this command
php artisan vendor:publish --tag=users-roles-permissions-config
you can create additional permissions using cwsps-permissions.php config file.
The updated permissions can sync to database using this command
php artisan permissions:sync
Note:Override may do in random manner for packages, the project config have more priority
In your languages directory, add an extra translation for the mobile field by propaganistas/laravel-phone
Note:run this command to publish lang folder
php artisan lang:publish
'phone' => 'The :attribute field must be a valid number.',
#Screenshots








The author
CWSPS154 is a passionate developer specializing in PHP, Laravel, and Magento. They contribute to the open-source community by creating tools that enhance the functionality and usability of Filament-based applications. Known for their dedication and expertise, CWSPS154 continuously strives to improve and expand their skill set, making valuable contributions to the developer community.
From the same author
Featured Plugins
A selection of plugins curated by the Filament team
Custom Dashboards
Let your users build and share their own dashboards with a drag-and-drop interface. Define your data sources in PHP and let them do the rest.
Filament
Custom Fields
Eliminate custom field migrations forever. Let your users create and manage form fields directly in Filament admin panels with 20+ built-in field types, validation, and zero database changes.
Relaticle
Advanced Tables (formerly Filter Sets)
Supercharge your tables with powerful features like user-customizable views, quick filters, multi-column sorting, advanced table searching, convenient view management, and more. Compatible with Resource Panel Tables, Relation Managers, Table Widgets, and Table Builder!
Kenneth Sese