File: D:/HostingSpaces/SBogers10/shop.komma.nl/app/Properties/PropertyPolicy.php
<?php declare(strict_types=1);
namespace App\Properties;
use App\Properties\Models\Property;
use Komma\KMS\Base\Policy;
use Komma\KMS\Users\Models\KmsUser;
use Komma\KMS\Users\Models\KmsUserRole;
class PropertyPolicy extends Policy
{
/**
* The before method will be executed before any other methods on the policy,
* giving you an opportunity to authorize the action before the
* intended policy method is actually called
*
* @param $user
* @param $ability
* @return bool
*/
public function before(KmsUser $user, $ability)
{
$result = $user->isAtLeast(KmsUserRole::SuperAdmin);
if($result) return true;
return null; //Fallback to the intended ability
}
/**
* Determine if it is allowed to store a new resource
* Usually made using a create form.
*
* @param KmsUser|null $user
* @return bool
*/
public function storeViaAjax(KmsUser $user): bool
{
return false;
}
/**
* Determine if it is allowed to update an existing resource after editing it
*
* @param KmsUser|null $user
* @return bool
*/
public function updateViaAjax(KmsUser $user): bool
{
return false;
}
}