/** * Store a newly created resource in storage. * * @return Response */ public function store(TestTypeRequest $request) { $testtype = new TestType(); $testtype->name = trim($request->name); $testtype->description = $request->description; $testtype->test_category_id = $request->test_category_id; $testtype->targetTAT = $request->targetTAT; $testtype->prevalence_threshold = $request->prevalence_threshold; $testtype->orderable_test = $request->orderable_test; $testtype->accredited = $request->accredited; $testtype->save(); $measureIds = array(); $inputNewMeasures = $request->new_measures; $measures = new MeasureController(); $measureIds = $measures->store($inputNewMeasures); $testtype->setMeasures($measureIds); $testtype->setSpecimenTypes($request->specimentypes); $testtype->setOrganisms($request->organisms); $url = session('SOURCE_URL'); return redirect()->to($url)->with('message', trans('terms.record-successfully-saved'))->with('active_testtype', $testtype->id); }