Devstagram/app/Policies/PostPolicy.php

19 lines
319 B
PHP

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