Fixed users activation and update/delete test
This commit is contained in:
parent
b58b6c6488
commit
d9e4e2c8cc
@ -22,7 +22,8 @@ class User extends Authenticatable
|
|||||||
'username',
|
'username',
|
||||||
'email',
|
'email',
|
||||||
'password',
|
'password',
|
||||||
'type'
|
'type',
|
||||||
|
'email_verified_at'
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -35,17 +35,17 @@ class TestPolicy
|
|||||||
/**
|
/**
|
||||||
* Determine whether the user can update the model.
|
* Determine whether the user can update the model.
|
||||||
*/
|
*/
|
||||||
public function update(User $user, Test $question): bool
|
public function update(User $user, Test $test): bool
|
||||||
{
|
{
|
||||||
return $user->type == 'admin' || $question->user_id == $user->id;
|
return $user->type == 'admin' || $test->author_id == $user->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine whether the user can delete the model.
|
* Determine whether the user can delete the model.
|
||||||
*/
|
*/
|
||||||
public function delete(User $user, Test $question): bool
|
public function delete(User $user, Test $test): bool
|
||||||
{
|
{
|
||||||
return $user->type == 'admin' || $question->user_id == $user->id;
|
return $user->type == 'admin' || $test->author_id == $user->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user