public function getRequest(Request $request) { $auth = auth()->user(); $match_request = MatchRequest::find($request->match_request_id); if (!$match_request || $auth->id != $match_request->target_id) { return ['success' => false]; } return $match_request; }
/** * Execute the job. * * @return void */ public function handle() { $match_request = new MatchRequest(['author_id' => $this->auth->id, 'target_id' => $this->target_id]); $match_request->save(); Event::fire(new OnMatchRequest($match_request)); }