Answer the question
In order to leave comments, you need to log in
How to implement rights to users with their laravel roles?
Tell me how you can implement it:
When you enter under the manager, only 2 actions are available to him - adding and deleting.
It seems that I did, but when editing or adding an error in the table with roles
//Таблица ролей
Schema::create('roles',function (Blueprint $table) {
$table->increments('id');
$table->string('name',50);
$table->timestamps();
});
//таблица пользователей
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->integer('role_id')->unsigned();
$table->foreign('role_id')->references('id')->on('roles');
$table->string('name')->nullable();
$table->string('company_name')->nullable();
$table->string('email', 100)->unique();
$table->string('password')->nullable();
$table->rememberToken();
$table->boolean('active');
$table->timestamps();
});
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'roles.role_id' in 'where clause' (SQL: select * from `roles` where `roles`.`role_id` = 1 and `roles`.`role_id` is not null)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question