ldc-supportweb/app/Policies/CreditLogPolicy.php

34 lines
863 B
PHP
Raw Permalink Normal View History

2022-05-31 14:06:07 +02:00
<?php
namespace App\Policies;
use App\Models\User;
2022-07-01 11:05:15 +02:00
use App\Policies\Rules\CreditAccountLogRules;
2022-05-31 14:06:07 +02:00
use Illuminate\Auth\Access\HandlesAuthorization;
use Illuminate\Database\Eloquent\Model;
use Kwaadpepper\CrudPolicies\Policies\RootPolicy;
class CreditLogPolicy extends RootPolicy
{
use HandlesAuthorization;
/**
* Init policies on call
*
2022-08-30 13:21:07 +00:00
* @param \App\Models\User $user
* @param \Illuminate\Database\Eloquent\Model $model
2022-05-31 14:06:07 +02:00
* @return void
*/
public function setPolicies(User $user, Model $model = null)
{
/**
* This first rule to return true in a policy action authorises the action
*/
$this->policies = [
'creditlog' => [
2022-07-01 11:05:15 +02:00
'viewAny' => CreditAccountLogRules::make('nonAdminUserHasBrands', $user, $model)
2022-05-31 14:06:07 +02:00
]
];
}
}