Support the ongoing development of Laravel.io →
Laravel Database Authentication
Last updated 2 years ago.
0

UPDATE When dumping the role of the user in a view the role is also correct. May it has to do something with my routes and the way I am routing?

0

hi, hummmm I don't like your relation is good but not logic so you will try it

Schema::create('users', function (Blueprint $table) { $table->bigIncrements('id'); $table->enum('role', ['admin', 'redac', 'user'])->default('user'); $table->string('name', 255)->unique(); $table->string('email')->unique()->nullable(); $table->timestamp('email_verified_at')->nullable(); $table->string('password')->nullable(); $table->timestamps(); });

you don't need the roles table when your applicaqtion is not big and also it is factive roles you can adapt them to your taste ['superAdmin', ect ...].

But however if you still want to manage a large number of roles you can use this excellent LaravelPermission package.

Where you can define a pivot class between user and role comment in the documentation of laravel role_user

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Jan frazecolder Joined 7 Feb 2021

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.