This commit is contained in:
Saufi
2026-06-02 17:35:45 +08:00
commit 4ef99b1f81
148 changed files with 21134 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
<?php
namespace App\Policies;
use App\Models\ProjectComment;
use App\Models\TranscriptionProject;
use App\Models\User;
class CommentPolicy
{
public function view(User $user, TranscriptionProject $project): bool
{
return $project->isAccessibleBy($user);
}
public function create(User $user, TranscriptionProject $project): bool
{
return $project->isAccessibleBy($user);
}
public function delete(User $user, ProjectComment $comment): bool
{
$project = $comment->project;
return $comment->user_id === $user->id || $project->isOwnedBy($user);
}
}