feat(auth): introduce resource creation authorization middleware and policies for enhanced access control

This commit is contained in:
Andras Bacsai
2025-08-24 17:14:33 +02:00
parent 0702d29ae1
commit 3e1f47a243
9 changed files with 256 additions and 4 deletions

View File

@@ -0,0 +1,20 @@
<?php
namespace App\Traits;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
trait AuthorizesResourceCreation
{
use AuthorizesRequests;
/**
* Authorize creation of all supported resources.
*
* @throws \Illuminate\Auth\Access\AuthorizationException
*/
protected function authorizeResourceCreation(): void
{
$this->authorize('createAnyResource');
}
}