clrghouz/app/Policies/SystemPolicy.php

24 lines
499 B
PHP
Raw Normal View History

<?php
namespace App\Policies;
use Illuminate\Auth\Access\HandlesAuthorization;
use App\Models\{System,User};
class SystemPolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can update the model.
*
* @param \App\Models\User $user
* @param \App\Models\System $system
* @return \Illuminate\Auth\Access\Response|bool
*/
public function update(User $user, System $system)
{
return (! $system->exists) || $system->users->contains($user) || $user->isAdmin();
}
}