Black Friday: coupon FRIDAY24 for 40% off Yearly/Lifetime membership! Read more here

CMS Blog with Shield Roles and Permissions

Roles and Permissions are really common. The Filament ecosystem has a few options for how to do them. This example showcases the Shield plugin.

FilamentExamples ThumbBase (34)

Get the Source Code:

How it works

This example is based on the CMS Blog system.

All roles are created, and permissions are granted using the UI of the Filament Shield plugin.

The Post Resource must have additional publish_post permission. To add such additional permissions, the Resource must implement the HasShieldPermissions interface. Then, in the getPermissionPrefixes(), provide all the policies.

app/Filament/Resources/PostResource.php:

use BezhanSalleh\FilamentShield\Contracts\HasShieldPermissions;
 
class PostResource extends Resource implements HasShieldPermissions
{
// ...
 
public static function getPermissionPrefixes(): array
{
return [
'view',
'view_any',
'create',
'update',
'delete',
'delete_any',
'publish',
];
}
}
The FULL tutorial is available after the purchase: in the Readme file of the official repository you would get invited to.
Get the Source Code: All 64 Premium Examples for $99