2016-07-06 20:35:16 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Policies;
|
|
|
|
|
2016-07-07 10:44:15 +02:00
|
|
|
use App\Models\User;
|
|
|
|
|
|
|
|
class ExpenseCategoryPolicy extends EntityPolicy
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param User $user
|
|
|
|
* @return bool
|
|
|
|
*/
|
2016-10-28 08:42:49 +02:00
|
|
|
public static function create(User $user, $item) {
|
2016-07-07 10:44:15 +02:00
|
|
|
return $user->is_admin;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param User $user
|
|
|
|
* @param $item
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public static function edit(User $user, $item) {
|
|
|
|
return $user->is_admin;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param User $user
|
|
|
|
* @param $item
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public static function view(User $user, $item) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param User $user
|
|
|
|
* @param $ownerUserId
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public static function viewByOwner(User$user, $ownerUserId) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param User $user
|
|
|
|
* @param $ownerUserId
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public static function editByOwner(User $user, $ownerUserId) {
|
|
|
|
return $user->is_admin;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|