Fixed users activation and update/delete test

This commit is contained in:
Stepan 2026-01-02 21:06:20 +01:00
parent b58b6c6488
commit d9e4e2c8cc
2 changed files with 6 additions and 5 deletions

View File

@ -22,7 +22,8 @@ class User extends Authenticatable
'username', 'username',
'email', 'email',
'password', 'password',
'type' 'type',
'email_verified_at'
]; ];
/** /**

View File

@ -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;
} }
/** /**