Official Laravel source
AttributeIlluminate\Container\Attributes\Authenticated

#[Authenticated]

Attribute to inject authentication into a method parameter.

Available since

Laravel 13.0

Targets

parameter

Parameters

  • $guardUnitEnum|string|null

    Authentication guard to use.

Practical usage

use Illuminate\Container\Attributes\Auth;

class ReportsController {
    public function __invoke(#[Auth('web')] mixed $user): array {
        return ['status' => 'ok'];
    }
}