update patch 1

This commit is contained in:
fiqhpratama
2024-12-02 01:18:34 +07:00
parent 453d9bb470
commit 25026b0a85
3380 changed files with 103529 additions and 363623 deletions
+24
View File
@@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
namespace App\Traits;
use Illuminate\Contracts\Auth\Authenticatable;
trait AuthorizationChecker
{
/**
* Check if the user is authorized to perform the action.
*
* @param Authenticatable $user
* @param array|string $permissions
* @return void
*/
public function checkAuthorization($user, $permissions): void
{
if (is_null($user) || !$user->can($permissions)) {
abort(403, 'Sorry !! You are unauthorized to perform this action.');
}
}
}