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?
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
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community