/** * Store a newly created resource in storage. * * @param Request $request * @return Response */ public function store(Request $request) { //We need to set the Engineer as unavailable $e = Engineer::find($request["engineer_id"]); $e->available = 0; $e->save(); $post_data = $request->all(); if ($post_data["engineer_email"]) { //Send e-mail to responsible engineer $mail = Mail::raw("You have receixed a new chat request, please check the tool now!", function ($message) use($post_data) { $message->from('*****@*****.**', 'RTS Tool'); $message->to($post_data["engineer_email"])->subject('New RTS request!'); }); } return Chat::create($request->all()); }
public function closedChat($engineer_id) { return Engineer::find($engineer_id)->closedChat; }