コード例 #1
0
ファイル: TestsController.php プロジェクト: ramant15/ektimo
 public function create()
 {
     $processes = array();
     $tests = DB::table('tests')->join('parameters', 'tests.parameter_id', '=', 'parameters.id')->join('states', 'tests.state_id', '=', 'states.id')->join('methods', 'tests.method_id', '=', 'methods.id')->join('test_methods', 'tests.test_method_id', '=', 'test_methods.id')->select('tests.id', 'tests.price', 'parameters.name as parameter', 'states.name as state', 'methods.name as method', 'states.name as state', 'test_methods.name as test_method')->get();
     $items = ProcessItem::where('status', '=', 1)->get();
     return view('admin.tests.create')->with(compact('items', 'tests'));
 }
コード例 #2
0
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index(Request $request)
 {
     $test = $request->get('test');
     $processes = array();
     if ($test) {
         $processData = DB::table('test_processes')->where('test_id', '=', $test)->select('item_id')->get();
         $processes = array();
         foreach ($processData as $key => $value) {
             $processes[] = $value->item_id;
         }
     }
     $tests = DB::table('tests')->join('parameters', 'tests.parameter_id', '=', 'parameters.id')->join('states', 'tests.state_id', '=', 'states.id')->join('methods', 'tests.method_id', '=', 'methods.id')->join('test_methods', 'tests.test_method_id', '=', 'test_methods.id')->select('tests.id', 'tests.price', 'parameters.name as parameter', 'states.name as state', 'methods.name as method', 'states.name as state', 'test_methods.name as test_method')->orderBy('parameters.name')->get();
     $items = ProcessItem::where('status', '=', 1)->get();
     return view('admin.processes.index')->with(compact('items', 'tests', 'processes'));
 }
コード例 #3
0
ファイル: TestsController.php プロジェクト: ramant15/ektimo
 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'));
 }
コード例 #4
0
 function update(Request $request, $id)
 {
     $input = $request->all();
     $rules = ProcessItem::$rules;
     unset($rules['image']);
     if (isset($input['image'])) {
         $image = $request->file('image');
         $imageName = $image->getClientOriginalName();
         $image->move(public_path() . '/ItemImages/', $imageName);
         $input['image'] = $imageName;
     }
     $processItem = ProcessItem::find($id);
     $processItem->update($input);
     Session::flash('flash_message', 'Process Item has been updated successfully.');
     Session::flash('flash_type', 'alert-success');
     return redirect('admin/process-items');
 }