Level 4
If I did understand you well, you want to test the pivot table if it holds a record with the user id, permission_id and permission_level = 4.
When you dump($user->permissions); what get return?
I have an additional column in my permission_user table of permission_level.
I am trying to TTD a helper method but don't know how to test the ->pivot().
This is where I am:
/** @test */
public function a_user_can_be_assigned_a_permission () {
$user = create(User::class);
$permission = create(Permission::class, [
'name' => 'Returns',
'display' => 'RMAs'
]);
$pivot = create(PermissionUser::class, [
'user_id' => $user->id,
'permission_id' => $permission->id,
'permission_level' => 4
]);
dump($user->permissions);
$this->assertCount(1, $user->permissions);
} // end test
Please or to participate in this conversation.