wip
This commit is contained in:
81
stubs/policy.stub
Normal file
81
stubs/policy.stub
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace {{ namespace }};
|
||||
|
||||
use Illuminate\Auth\Access\Response;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
use {{ namespacedModel }};
|
||||
use {{ namespacedUserModel }};
|
||||
|
||||
class {{ class }}
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
/**
|
||||
* Perform pre-authorization checks.
|
||||
*/
|
||||
public function before({{ user }} $user, string $ability): Response|null
|
||||
{
|
||||
if ($user->isMe()) {
|
||||
return $this->allow();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*/
|
||||
public function viewAny({{ user }} $user): Response
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view({{ user }} $user, {{ model }} ${{ modelVariable }}): Response
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create({{ user }} $user): Response
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update({{ user }} $user, {{ model }} ${{ modelVariable }}): Response
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete({{ user }} $user, {{ model }} ${{ modelVariable }}): Response
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore the model.
|
||||
*/
|
||||
public function restore({{ user }} $user, {{ model }} ${{ modelVariable }}): Response
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete the model.
|
||||
*/
|
||||
public function forceDelete({{ user }} $user, {{ model }} ${{ modelVariable }}): Response
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user