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