/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(CreateToolRequest $request) { // $tool = \App\Models\Tool::create($request->all()); $tool->save(); if ($request->input('tech_name') != NULL) { $technician = Technician::create($request->all()); $tool->technician_id = $technician->id; $tool->save(); } return redirect('tools/' . $tool->id)->with('message-success', 'Tool has been added.'); }