Thursday, April 13, 2017

Laravel : Service provider for methods

I'm building a php class which need for some methods a Request instance.

Example :

static public function warningAlert($message, Request $request) {
    $request->session()->flash('alert-warning', "$message");
}

I thought that the service provider will provide this instance but he dont :

Argument 2 passed to ...\validatorAlerts() must be an instance of Illuminate\Http\Request, none given

How can I provide him ?

PS : I don't wan't to use facades.



via Thomas Petillot

Advertisement