/**
  * Update the specified resource in storage.
  *
  * @param  \App\Http\Requests\OptionRequest $request
  * @param \App\Criteria $criteria
  *  @param \App\CriteriaOption $option
  * @return \Illuminate\Http\Response
  */
 public function update(Requests\OptionRequest $request, Criteria $criteria, CriteriaOption $option)
 {
     DB::transaction(function () use($request, $option) {
         $option->update(['sort' => $request->get('sort')]);
         foreach ($option->langs as $lang) {
             $lang->update(['title' => $request->get('title_' . systemTrans($lang['lang_id']))]);
         }
     });
     return redirect(action('Admin\\CriteriaOptionController@index', [$criteria->id]))->with('success', 'updated');
 }
예제 #2
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \App\Http\Requests\NewsRequest $request
  * @param  \App\News $news
  * @return \Illuminate\Http\Response
  */
 public function update(Requests\NewsRequest $request, News $news)
 {
     DB::transaction(function () use($request, $news) {
         $update = ['active' => $request->get('active'), 'sort' => $request->get('sort')];
         if ($this->systemAdmin) {
             $update['department_id'] = $request->get('department_id');
         }
         $news->update($update);
         foreach ($news->langs as $lang) {
             $lang->update(['title' => $request->get('title_' . systemTrans($lang['lang_id'])), 'description' => $request->get('description_' . systemTrans($lang['lang_id']))]);
         }
     });
     return redirect(action('Admin\\NewsController@index'))->with('success', 'updated');
 }
예제 #3
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \App\Http\Requests\CriteriaRequest $request
  * @param  \App\Criteria $criteria
  * @return \Illuminate\Http\Response
  */
 public function update(Requests\CriteriaRequest $request, Criteria $criteria)
 {
     DB::transaction(function () use($request, $criteria) {
         $update = ['required' => $request->get('required'), 'visible' => $request->get('visible'), 'admin' => $request->get('admin'), 'sort' => $request->get('sort'), 'type_id' => $request->get('type_id')];
         if ($this->systemAdmin) {
             $update['department_id'] = $request->get('department_id');
         }
         $criteria->update($update);
         foreach ($criteria->langs as $lang) {
             $lang->update(['title' => $request->get('title_' . systemTrans($lang['lang_id']))]);
         }
     });
     return redirect(action('Admin\\CriteriaController@index'))->with('success', 'updated');
 }
예제 #4
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  \App\Department  $department
  * @return \Illuminate\Http\Response
  */
 public function edit(Department $department)
 {
     $department->load('langs');
     foreach ($department->langs as $lang) {
         foreach (['name', 'title', 'description'] as $elem) {
             $key = $elem . '_' . systemTrans($lang['lang_id']);
             $department->{$key} = $lang[$elem];
         }
     }
     return view('admin.department.edit', ['department' => $department]);
 }
예제 #5
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \App\Http\Requests\CategoryRequest $request
  * @param  \App\Category  $category
  * @return \Illuminate\Http\Response
  */
 public function update(Requests\CategoryRequest $request, Category $category)
 {
     DB::transaction(function () use($request, $category) {
         $update = ['sort' => $request->get('sort'), 'active' => $request->get('active')];
         if ($this->systemAdmin) {
             $update['department_id'] = $request->get('department_id');
         }
         $category->update($update);
         foreach ($category->langs as $lang) {
             $lang->update(['name' => $request->get('name_' . systemTrans($lang['lang_id']))]);
         }
     });
     return redirect(action('Admin\\CategoryController@index'))->with('success', 'updated');
 }