Наследование: extends App\Http\Requests\Request
Пример #1
0
 /**
  * Update the specified resource in storage.
  *
  * @param int                                     $id
  * @param \App\Http\Requests\Back\FragmentRequest $fragmentRequest
  *
  * @return \App\Http\Controllers\Back\Response
  */
 public function update($id, FragmentRequest $fragmentRequest)
 {
     $fragment = $this->fragmentRepository->findById($id);
     $fragment->updateWithRelations($fragmentRequest->all());
     $this->fragmentRepository->save($fragment);
     $eventDescription = trans('back.events.updated', ['model' => 'Fragment', 'name' => $fragment->name]);
     Activity::log($eventDescription);
     flash()->success(strip_tags($eventDescription));
     return redirect()->action('Back\\FragmentController@edit', [$fragment->id]);
 }
Пример #2
0
 public function update($id, FragmentRequest $request)
 {
     $fragment = Fragment::find($id);
     foreach (locales() as $locale) {
         $requestAttribute = "translated_{$locale}_text";
         $fragment->setTranslation($locale, $request->get($requestAttribute));
     }
     $fragment->save();
     app('cache')->flush();
     $eventDescription = fragment('back.events.updated', ['model' => 'Fragment', 'name' => $fragment->name]);
     flash()->success(strip_tags($eventDescription));
     return redirect()->action('Back\\FragmentsController@index');
 }