Reference

Artisan Commands

On this page

systemroles:migrate#

Bash
php artisan systemroles:migrate

Runs only the package's migrations from vendor/baberuka/systemroles/database/migrations. Creates the migrations table if needed. Prints the migrations it ran, or "No SystemRoles migrations to run."

Use it when you want to install the package tables without running your app's own pending migrations.

The package also registers its migrations with Laravel, so php artisan migrate runs them as well. Each migration skips its table if it already exists.

systemroles:sync#

Bash
php artisan systemroles:sync
php artisan systemroles:sync --classes
Option Effect
(none) Stores every registered route in system_routes. Prints "Routes: X added, Y updated."
--classes Also scans controller_directory and stores every controller in system_classes

Routes are matched on method + URL. Controllers are matched on namespace + class name. Neither removes rows for routes or controllers that no longer exist.

Run it:

  • after each deploy, if scan_on_request is false;
  • after adding routes or controllers you want to manage.

In a deploy script:

Bash
php artisan migrate --force
php artisan systemroles:sync --classes
php artisan config:cache
php artisan route:cache

The command reads the routes Laravel has loaded, so it works with or without a route cache.

Seeding#

Not a command of its own, but part of setup:

Bash
php artisan db:seed --class="Database\Seeders\SystemRolesSeeder"

Creates the four default roles (ids 1–4) if they don't exist. Call it from your own DatabaseSeeder to include it in php artisan db:seed:

PHP
public function run(): void
{
    $this->call(\Database\Seeders\SystemRolesSeeder::class);
}