Initial commit
This commit is contained in:
25
app/Policies/NewsPostPolicy.php
Normal file
25
app/Policies/NewsPostPolicy.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\NewsPost;
|
||||
use App\Models\User;
|
||||
use Illuminate\Auth\Access\Response;
|
||||
|
||||
class NewsPostPolicy
|
||||
{
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return (bool) $user->is_admin; // nebo kontrola role
|
||||
}
|
||||
|
||||
public function update(User $user, NewsPost $news): bool
|
||||
{
|
||||
return (bool) $user->is_admin;
|
||||
}
|
||||
|
||||
public function delete(User $user, NewsPost $news): bool
|
||||
{
|
||||
return (bool) $user->is_admin;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user