I am trying to create new record using seeder.
This is the code i wrote on seeder file:
RoleUser::create(['role_id'=>$roleId[0],'user_id'=>$user->id]);
PermissionRole::create(['permission_id'=>1,'role_id'=>$roleId[0]]);
This is the error i am getting
[ErrorException] Illegal offset type
RoleUser model is used for role_user table
Schema::create('role_user', function (Blueprint $table) {
$table->integer('role_id')->unsigned();
$table->integer('user_id')->unsigned();
$table->primary(['role_id','user_id']);
});
PermissionRole model is used for permission_role table
Schema::create('permission_role', function (Blueprint $table) {
$table->integer('permission_id')->unsigned();
$table->integer('role_id')->unsigned();
$table->primary(['permission_id','role_id']);
});
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2e9H6BP
via IFTTT
Aucun commentaire:
Enregistrer un commentaire