Official Laravel source
AttributeIlluminate\Foundation\Http\Attributes\ErrorBag

#[ErrorBag]

Applies an error bag to the target element, allowing for the capture of error messages.

Available since

Laravel 13.0

Targets

class

Parameters

  • $namestring

    Name of the error bag.

Practical usage

use Illuminate\Foundation\Http\Attributes\ErrorBag;

#[ErrorBag('custom_error_bag')]
class AppService
{
    //...
}