HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
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;
    }
}