Exemplo n.º 1
0
 /**
  * @param \Minhbang\Ebook\Request $request
  * @param \Minhbang\Ebook\Ebook $ebook
  *
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function update(EbookRequest $request, Ebook $ebook)
 {
     if ($ebook->canUpdate()) {
         $ebook->fill($request->all() + ['featured' => 0]);
         $ebook->fillFeaturedImage($request);
         $ebook->fileFill($request);
         $ebook->user_id = user('id');
         $ebook->fillStatus($request->get('s'));
         $ebook->enumDirty = true;
         $ebook->save();
         Session::flash('message', ['type' => 'success', 'content' => trans('common.update_object_success', ['name' => trans('ebook::common.ebooks')])]);
     } else {
         Session::flash('message', ['type' => 'danger', 'content' => trans('ilib::common.messages.unable_update')]);
     }
     return redirect(route($this->route_prefix . 'backend.ebook.index'));
 }