messages implemented
This commit is contained in:
25
app/Policies/ArtworkCommentPolicy.php
Normal file
25
app/Policies/ArtworkCommentPolicy.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user