Add user based bots and policy
All checks were successful
Deploy App / deploy (push) Successful in 9s
All checks were successful
Deploy App / deploy (push) Successful in 9s
This commit is contained in:
23
app/Policies/BotPolicy.php
Normal file
23
app/Policies/BotPolicy.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\Bot;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class BotPolicy
|
||||
{
|
||||
/**
|
||||
* Create a new policy instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
return Auth::check();
|
||||
}
|
||||
|
||||
public function view(User $user, Bot $bot): bool
|
||||
{
|
||||
return $user->id === $bot->user_id;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user