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
|
2017-01-30 20:40:43 +01:00
|
|
|
*
|
2016-07-07 10:44:15 +02:00
|
|
|
* @return bool
|
|
|
|
*/
|
2017-01-30 17:05:31 +01: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
|
|
|
|
*/
|
2017-01-30 17:05:31 +01:00
|
|
|
public static function edit(User $user, $item)
|
|
|
|
{
|
2016-07-07 10:44:15 +02:00
|
|
|
return $user->is_admin;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param User $user
|
|
|
|
* @param $item
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
2017-01-30 17:05:31 +01:00
|
|
|
public static function view(User $user, $item)
|
|
|
|
{
|
2016-07-07 10:44:15 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param User $user
|
|
|
|
* @param $ownerUserId
|
2017-01-30 20:40:43 +01:00
|
|
|
*
|
2016-07-07 10:44:15 +02:00
|
|
|
* @return bool
|
|
|
|
*/
|
2017-01-30 20:40:43 +01:00
|
|
|
public static function viewByOwner(User $user, $ownerUserId)
|
2017-01-30 17:05:31 +01:00
|
|
|
{
|
2016-07-07 10:44:15 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param User $user
|
|
|
|
* @param $ownerUserId
|
2017-01-30 20:40:43 +01:00
|
|
|
*
|
2016-07-07 10:44:15 +02:00
|
|
|
* @return bool
|
|
|
|
*/
|
2017-01-30 17:05:31 +01:00
|
|
|
public static function editByOwner(User $user, $ownerUserId)
|
|
|
|
{
|
2016-07-07 10:44:15 +02:00
|
|
|
return $user->is_admin;
|
|
|
|
}
|
|
|
|
}
|