/** * 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'); }