User roles

By default, Laravel does not assign user roles. However, there are many use cases for different user roles, for example if an admin should have access to a dashboard with sensible data that another user should not be able to see. Therefore, the Laravel Next.js Starter Kit populates the user table in the database with an additional column named role, which expects a string. You can find this configuration in the user migrations file under /database/migrations. There, you'll also see that the default role of a new user is "user".


When running php artisan migrate:fresh --seed, a couple of users will be created. The user with the ID 1 is named "Super-Admin" and has the role "admin". This is your super user who should have access to everything. You can configure the behaviour to your needs under /database/seeders/UserSeeder. The run() method will be called in the DatabaseSeeder when running a fresh migration with a seed.

You can define the email of the Super-Admin in the .env at the root directory of your project by changing the ADMIN_EMAIL_ADDRESS value. If you leave this value empty it will default to "admin@examplemail.com"