From d9e4e2c8ccb27511653ed4ed210f87a27e982a9f Mon Sep 17 00:00:00 2001 From: Stepan Date: Fri, 2 Jan 2026 21:06:20 +0100 Subject: [PATCH] Fixed users activation and update/delete test --- app/Models/User.php | 3 ++- app/Policies/TestPolicy.php | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/Models/User.php b/app/Models/User.php index fc34187..6aac6fe 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -22,7 +22,8 @@ class User extends Authenticatable 'username', 'email', 'password', - 'type' + 'type', + 'email_verified_at' ]; /** diff --git a/app/Policies/TestPolicy.php b/app/Policies/TestPolicy.php index 1229129..14d5160 100644 --- a/app/Policies/TestPolicy.php +++ b/app/Policies/TestPolicy.php @@ -35,17 +35,17 @@ class TestPolicy /** * 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. */ - 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; } /**