ldc-supportweb/app/Policies/AccountPolicy.php

74 lines
1.3 KiB
PHP
Raw Permalink Normal View History

2022-05-31 14:06:07 +02:00
<?php
namespace App\Policies;
use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class AccountPolicy
2022-05-31 14:06:07 +02:00
{
use HandlesAuthorization;
/**
* Determine if the user can view any accounts.
2022-05-31 14:06:07 +02:00
*
* @return boolean
2022-05-31 14:06:07 +02:00
*/
public function viewAny(): bool
2022-05-31 14:06:07 +02:00
{
return auth()->check();
}
/**
* Determine if the user can view a given account.
*
* @return boolean
*/
public function view(): bool
{
return false;
}
/**
* Determine if the user can create a new account.
*
* @param \App\Models\User $user
* @return boolean
*/
public function create(User $user): bool
{
return $user->isAdmin();
}
/**
* Determine if the user can update a given account.
*
* @return boolean
*/
public function update(): bool
{
return false;
}
/**
* Determine if the user can delete a given account.
*
* @param \App\Models\User $user
* @return boolean
*/
public function delete(User $user): bool
{
return $user->isAdmin();
}
/**
* Determine if the user can credit a given account.
*
* @return boolean
*/
public function credit(): bool
{
return true;
2022-05-31 14:06:07 +02:00
}
}