#2 create post

This commit is contained in:
Saufi
2026-05-12 10:42:23 +08:00
parent 53be5221e9
commit 0192769ba3
43 changed files with 3331 additions and 26 deletions

View File

@@ -0,0 +1,34 @@
<?php
namespace App\Policies;
use App\Models\Post;
use App\Models\User;
class PostPolicy
{
public function viewAny(User $user): bool
{
return true;
}
public function view(User $user, Post $post): bool
{
return $user->id === $post->user_id;
}
public function create(User $user): bool
{
return true;
}
public function update(User $user, Post $post): bool
{
return $user->id === $post->user_id;
}
public function delete(User $user, Post $post): bool
{
return $user->id === $post->user_id;
}
}