cwsps154/users-roles-permissions
最新稳定版本:v1.0.4
Composer 安装命令:
composer require cwsps154/users-roles-permissions
包简介
Filament User & Roles & Permissions
关键字:
README 文档
README
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
统计信息
- 总下载量: 2.44k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 18
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-04








