ldc-supportweb/app/Policies/AccountPolicy.php

74 lines
1.2 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()
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()
{
return false;
}
/**
* Determine if the user can create a new account.
*
* @param \App\Models\User $user
* @return boolean
*/
public function create(User $user)
{
return $user->isAdmin();
}
/**
* Determine if the user can update a given account.
*
* @return boolean
*/
public function update()
{
return false;
}
/**
* Determine if the user can delete a given account.
*
* @param \App\Models\User $user
* @return boolean
*/
public function delete(User $user)
{
return $user->isAdmin();
}
/**
* Determine if the user can credit a given account.
*
* @return boolean
*/
public function credit()
{
return true;
2022-05-31 14:06:07 +02:00
}
}