Exemplo n.º 1
0
 /**
  * @param \Minhbang\Ebook\Ebook $ebook
  *
  * @return \Illuminate\View\View
  */
 public function edit(Ebook $ebook)
 {
     if ($ebook->allowed(user(), 'update')) {
         $url = route($this->route_prefix . 'backend.ebook.update', ['ebook' => $ebook->id]);
         $method = 'put';
         $categories = $this->categoryManager->selectize();
         $name = trans('ebook::common.ebooks');
         $this->buildHeading([trans('common.update'), $name], 'edit', [route($this->route_prefix . 'backend.ebook.index') => $name, '#' => trans('common.edit')]);
         $ebook->enumRestore();
         $file_hint = trans('ebook::common.file_hint_edit');
         return view('ebook::backend.form', compact('ebook', 'categories', 'url', 'method', 'categories', 'file_hint') + $ebook->loadEnums());
     } else {
         return view('message', ['module' => trans('ilib::common.ilib'), 'type' => 'danger', 'content' => trans('ilib::common.messages.unable_update')]);
     }
 }