ultimatepos/Modules/AssetExchange/Http/Controllers/Concerns/AuthorizesAssetExchange.php

18 lines
422 B
PHP

<?php
namespace Modules\AssetExchange\Http\Controllers\Concerns;
trait AuthorizesAssetExchange
{
protected function authorizeAexAccess(?string $permission = null): void
{
if (! auth()->user()->can('aex.access')) {
abort(403, 'Unauthorized action.');
}
if ($permission && ! auth()->user()->can($permission)) {
abort(403, 'Unauthorized action.');
}
}
}