mirror of
https://github.com/HtetPhone/MangaDex.git
synced 2025-02-20 11:23:19 +08:00
77 lines
1.5 KiB
PHP
77 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Policies;
|
|
|
|
use App\Models\Comment;
|
|
use App\Models\User;
|
|
use Illuminate\Auth\Access\Response;
|
|
|
|
class CommentPolicy
|
|
{
|
|
/**
|
|
* access all to admin
|
|
*/
|
|
// public function before(User $user)
|
|
// {
|
|
// if($user->role === 'admin') {
|
|
// return true;
|
|
// }
|
|
// }
|
|
|
|
/**
|
|
* Determine whether the user can view any models.
|
|
*/
|
|
public function viewAny(User $user): bool
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Determine whether the user can view the model.
|
|
*/
|
|
public function view(User $user, Comment $comment): bool
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Determine whether the user can create models.
|
|
*/
|
|
public function create(User $user): bool
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Determine whether the user can update the model.
|
|
*/
|
|
public function update(User $user, Comment $comment): bool
|
|
{
|
|
return $comment->user()->is($user);
|
|
}
|
|
|
|
/**
|
|
* Determine whether the user can delete the model.
|
|
*/
|
|
public function delete(User $user, Comment $comment): bool
|
|
{
|
|
return $this->update($user, $comment) || $user->role === 'admin';
|
|
}
|
|
|
|
/**
|
|
* Determine whether the user can restore the model.
|
|
*/
|
|
public function restore(User $user, Comment $comment): bool
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Determine whether the user can permanently delete the model.
|
|
*/
|
|
public function forceDelete(User $user, Comment $comment): bool
|
|
{
|
|
//
|
|
}
|
|
}
|