function edit($id) { $test = Test::join('parameters', 'parameters.id', '=', 'tests.parameter_id')->join('test_methods', 'test_methods.id', '=', 'tests.test_method_id')->join('methods', 'methods.id', '=', 'tests.method_id')->join('states', 'states.id', '=', 'tests.state_id')->where('tests.id', '=', $id)->select('tests.*', 'test_methods.name as test_method_name', 'methods.name as method_name', 'parameters.name as param_name', 'states.name as state_name')->first(); if (is_null($test)) { return redirect('admin/tests'); } $selected_items = Process::where('test_id', '=', $id)->join('process_items', 'test_processes.item_id', '=', 'process_items.id')->select('test_processes.item_id')->get(); foreach ($selected_items as $selected) { $selected_ids[] = $selected['item_id']; } $path = public_path() . '/TestFiles/' . $id; if (File::exists($path)) { $files = File::allFiles($path); if (!empty($files)) { foreach ($files as $file) { $documents[] = array('name' => $file->getfileName(), 'path' => $file->getpathName()); } } } $items = ProcessItem::where('status', '=', 1)->get(); return view('admin.tests.edit')->with(compact('items', 'selected_ids', 'test', 'documents')); }
/** * Remove the specified resource from storage. * * @param int $id * * @return Response */ public function destroy($id) { Process::destroy($id); Session::flash('flash_message', 'Process deleted!'); return redirect('admin/process'); }