Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Developer 8.0 Upgrade Guide

Arthur Parienté edited this page Jan 15, 2025 · 3 revisions

There are some changes in 8.0 for developers

New Admin Interface Upgrade Guide

Roles And Permissions

  • Now, we are using spatie/laravel-permission with bezhansalleh/filament-shield and Laravel Policies, providing more in-depth permissions on each model (like view_any, view, create, delete, edit, force_delete...).

  • Access to the admin interface is allowed if the user has the super_admin or the admin role or the page_Dashboard permission. To check if a user can access the admin interface, use $user->hasAdminAccess() which returns a boolean. You can also use Laravel Gates via $user->can('access_admin').

  • When creating a new Model (a core one), you need to create permissions related to this model using php artisan shield:generate --all --ignore-existing-policies -n. If your model follows the laravel conventions the policy will be autodiscovered, otherwise you need to register it. See https://laravel.com/docs/11.x/authorization#registering-policies. Note: always test a non authorized user can't access the resource.

  • The ability middleware does not exist anymore. To check if a user has admin access with a middleware, use the following middleware: can:access_admin. If you wanna check if a user can view modules (typically for non-filament compatible modules access) please use the can:view_module middleware.

  • To prevent any kind of privilege escalation only super admins are allowed to view/create/edit/delete/give/remove roles

Modules

Permissions

  • To access the modules dashboard, a user requires the view_module permission.

  • Every model in each module may have a policy within the Modules\ModuleName\Policies namespace.

  • If you want to generate these policies automatically please use php artisan shield:generate --all --ignore-existing-policies -n

  • These policies, in conjunction with the auto-discovery feature of Filament Shield, will generate new permissions that can be assigned to any role on the role page. Same thing goes for policy discovery, see https://laravel.com/docs/11.x/authorization#registering-policies

Backward Compatibility

  • With the upgrade to the new permissions system, modules can't be compatible both for Filament and non-Filament PHPVMS installs. However they just need some permissions changes (middlewares) to be 100% compatible. A module using the old admin UI can work with filament (as long as this module uses plain html and not the Form:: helper).

With Filament

  • Modules will now have their own Filament Panel, meaning they'll have a different sidebar, etc.
  • To create a Filament Panel for your module, use the following command: php artisan module:setup-filament yourModuleName
  • Then create filament resources/pages/widgets for your module using the php artisan make:filament-... command. You'll be prompted for the panel, and you just have to choose your yourModuleName::admin.
  • For development, refer to the Filament Documentation and the Livewire Documentation.

Support ActivityLog

  • In order to enable activity log in your module, you need to configure your module's Models and PanelProvider. For models please look at some core models like User and for the panel provider you need to add :
->bootUsing(function () {
	activity()->enableLogging();
})

Vite

  • Since version 9, Laravel comes by default with Vite instead of Webpack.
  • Initially, upgrading to Vite was not possible due to the constraints of the previous admin template. However, now, with Filament, we can and have successfully done it.
  • To compile your assets, use npm run build for production or npm run dev for local development.
  • Note: Vite includes hot reloading of the page with local development, meaning your page will automatically reload and assets recompile when you change something in a blade view/js file...

Improving Performance

  • In order to improve a lot performances please run: php artisan filament:optimize, php artisan optimize after each deployments.

Clone this wiki locally

Morty Proxy This is a proxified and sanitized view of the page, visit original site.