sweet1s/moonshine-roles-permissions
A Laravel package for managing roles and permissions in MoonShine admin panels. It provides a ready-to-use interface to assign roles, configure permissions, and control access to resources and sections.
Version 4.0.0 is a single-purpose release: MoonShine v4 support. There are no new end-user features beyond the compatibility bump, so treat this as a lockstep upgrade of moonshine/moonshine + sweet1s/moonshine-roles-permissions, not an optional minor update.
composer.json on the 4.0.0 tag and confirm the moonshine/moonshine (^4.0), spatie/laravel-permission, PHP, and Laravel version ranges against your app. The whole upgrade hinges on whether your app can move to MoonShine 4.moonshine/moonshine to ^4.0 and this package to ^4.0 together, then composer update moonshine/moonshine sweet1s/moonshine-roles-permissions --with-dependencies.php artisan vendor:publish --provider="SWEET1S\MoonshineRolesPermissions\...ServiceProvider" --force into a scratch directory and diff the config/views/migrations against what you have. Do not blindly --force over customised views.php artisan migrate, then php artisan permission:cache-reset and php artisan optimize:clear.HasRoles, and that guard_name on roles/permissions matches the guard MoonShine authenticates with.config/moonshine-roles-permissions.php (resource registration + guard), the package's src/Resources and src/Traits directories for the current class names, and the MoonShine 4 upgrade guide for whatever broke in your own admin code.app/MoonShine/Resources and register your subclasses, so MoonShine 4 API drift never forces you into vendor patches. This matters more now than at 3.x, because every MoonShine major will require a coordinated upgrade.config/permissions.php array, seed from it, and have a sync command that reconciles DB rows against code. Package UIs drift fast when permissions are typed in by hand.canAccess() and in menu/section visibility so the nav matches reality — a resource that 403s but still appears in the sidebar is a support ticket generator.Gate::before for super-admin bypass rather than sprinkling if ($user->hasRole('admin')) through resources, and keep that bypass out of the test environment so your permission tests actually assert something.guard_name must be that guard and the package config must point at the same one. Test it explicitly with a non-default guard user.app/MoonShine, then merge. Keep your overridden views minimal so the diff stays small.actingAs($admin) plus assertTrue($admin->can('...')), and add one smoke test per gated resource asserting visible/hidden for role and non-role users.^3.1 and pin MoonShine accordingly with -W.php artisan permission:cache-reset. Stale cache after a deploy is the most common "permissions don't work" report.guard_name mismatch produces permissions that exist but never match — check the roles/permissions tables' guard_name column against config/auth.php and the MoonShine guard.php artisan config:clear (or re-run config:cache) — otherwise your new config is invisible.3.1.0...4.0.0) and the composer.json constraints before upgrading; and check the issue tracker for post-release breakage.^4.0 and add a smoke test that boots MoonShine, so a future MoonShine 4.x minor that breaks the package surfaces in your pipeline rather than in production.How can I help you explore Laravel packages today?