/**
  * Display a listing of the resource.
  * @param \App\Criteria $criteria
  * @return \Illuminate\Http\Response
  */
 public function index(Criteria $criteria)
 {
     $criteria->load(['options', 'options.langs', 'langs']);
     $options = $criteria->options()->sort()->get();
     $criteria = $this->loadLangs(Collection::make([$criteria]))->first();
     $options = $this->loadLangs($options);
     return view('admin.criteria.option.index', ['title' => $criteria->dbLangs->get(dbTrans())->title . ' ' . trans('static.options'), 'url' => action('Admin\\CriteriaOptionController@create', [$criteria->id]), 'back' => action('Admin\\CriteriaController@index'), 'options' => $options, 'criteria' => $criteria]);
 }
Esempio n. 2
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  \App\Criteria $criteria
  * @return \Illuminate\Http\Response
  */
 public function edit(Criteria $criteria)
 {
     $criteria->load('langs');
     foreach ($criteria->langs as $lang) {
         $key = 'title_' . systemTrans($lang['lang_id']);
         $criteria->{$key} = $lang['title'];
     }
     return view('admin.criteria.edit', ['criteria' => $criteria]);
 }