how to pass variable to an event listener laravel

Solutions on MaxInterview for how to pass variable to an event listener laravel by the best coders in the world

showing results for - "how to pass variable to an event listener laravel"
Alonso
27 Oct 2019
1
2public function __construct(References $referee, Applications $user,Request $request)
3{
4$this->referee = $referee;
5$this->user = $user;
6$this->request=$request;
7}
8// ...and fire like this in controller  ...... event(new EmailRefereeOne($referee, $application,$request));
9// So you can access in your listener like this $event->request->input('company_name_for_submission');
10
11// Second option is easy: you can directly use Request facade in Listener like this without passing anything to the event. \Request::input( );
12