Files
SkinbaseNova/app/Policies/ArtworkCommentPolicy.php
2026-02-26 21:12:32 +01:00

26 lines
559 B
PHP

<?php
namespace App\Policies;
use App\Models\ArtworkComment;
use App\Models\User;
class ArtworkCommentPolicy
{
/**
* Users can update their own comments.
*/
public function update(User $user, ArtworkComment $comment): bool
{
return $user->id === (int) $comment->user_id;
}
/**
* Users can delete their own comments; admins can delete any comment.
*/
public function delete(User $user, ArtworkComment $comment): bool
{
return $user->id === (int) $comment->user_id || $user->is_admin;
}
}