ifnex/04_Laravel/app/Http/Middleware/StaffApiMiddleware.php
Kazem Alghasi 69800a2b1e refactor(api): relocate StaffApiMiddleware and update routes
Move StaffApiMiddleware from the Controllers directory to the correct
Middleware directory to adhere to Laravel directory structure standards.

- Relocate StaffApiMiddleware from `app/Http/Controllers` to `app/Http/Middleware`
- Update `api.php` to use the correct namespace for `StaffApiMiddleware`
- Add `IFNEX_Logistics_Review_Workflow_HANDOFF.md` documentation for the review workflow
2026-09-28 17:25:40 +03:30

28 lines
639 B
PHP

<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
class StaffApiMiddleware
{
public function handle(Request $request, Closure $next): Response
{
$user = $request->user();
if (!$user || !$user->hasAnyRole([
'super_admin',
'admin',
'staff',
])) {
return response()->json([
'success' => false,
'message' => 'شما اجازه دسترسی به این بخش را ندارید.',
], 403);
}
return $next($request);
}
}