laravel-12/app/Policies/PostPolicy.php

26 lines
467 B
PHP

<?php
namespace App\Policies;
use App\Models\Post;
use App\Models\User;
class PostPolicy
{
/**
* Determine whether the user can update the post.
*/
public function update(User $user, Post $post): bool
{
return $user->id === $post->user_id;
}
/**
* Determine whether the user can delete the post.
*/
public function delete(User $user, Post $post): bool
{
return $user->id === $post->user_id;
}
}