23 lines
555 B
PHP
23 lines
555 B
PHP
<?php
|
|
|
|
namespace Modules\AdvancedPlanning\Http\Controllers\Concerns;
|
|
|
|
use Modules\AdvancedPlanning\Utils\AdvancedPlanningUtil;
|
|
|
|
trait AuthorizesAdvancedPlanning
|
|
{
|
|
protected function authorizeAp(string $permission): void
|
|
{
|
|
$user = auth()->user();
|
|
if ($user->can($permission) || $user->can('ap.access') || $user->can('ap.view')) {
|
|
return;
|
|
}
|
|
abort(403, 'Unauthorized action.');
|
|
}
|
|
|
|
protected function businessId(): int
|
|
{
|
|
return app(AdvancedPlanningUtil::class)->getBusinessId();
|
|
}
|
|
}
|