Official Laravel source
AttributeIlluminate\Container\Attributes\Auth

#[Auth]

In the Container group, #[Auth] applies this configuration to the target Laravel element. It accepts 1 configuration parameter.

Available since

Laravel 13.0

Targets

parameter

Parameters

  • $guardUnitEnum|string|null

    Authentication guard to resolve. Expected type: UnitEnum|string|null.

Practical usage

use Illuminate\Container\Attributes\Auth;

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