示例#1
0
 /**
  * Update the specified resource in storage.
  *
  * @param PageRequest $request
  * @param  int $id
  * @return Response
  */
 public function update(PageRequest $request, $id)
 {
     Cache::forget('_pages');
     $data = $request->all();
     switch ($request->get('content_type')) {
         case "content":
             $data['component_id'] = $data['external_link'] = null;
             break;
         case "component":
             $data['content_id'] = $data['external_link'] = null;
             break;
         case "link":
             $data['content_id'] = $data['component_id'] = null;
             break;
     }
     if ($request->get('content_type') == "content" && $request->get('content_id') == "") {
         if ($content = $this->content->newContent(['title' => $request->get('create_content_title'), 'title_visibility' => $request->get('create_content_title_visibility'), 'status' => $request->get('create_content_status'), 'access' => serialize($request->get('create_content_access')), 'content' => $request->get('create_content_content')])) {
             $data['content_id'] = $content->id;
         } else {
             Flash::error(trans("whole::http/controllers.pages_flash_4"));
             return redirect()->route('admin.page.index');
         }
     }
     $data['access'] = serialize($data['access']);
     if ($this->page->saveData("update", $data, $id)) {
         Logs::add('process', trans("whole::http/controllers.pages_log_3", ['id' => $id]));
         Flash::success(trans("whole::http/controllers.pages_flash_5"));
         return redirect()->route('admin.page.index');
     } else {
         Logs::add('errors', trans("whole::http/controllers.pages_log_4", ['id' => $id]));
         Flash::error(trans("whole::http/controllers.pages_flash_3"));
         return redirect()->back();
     }
 }
示例#2
0
 /**
  * Update the specified resource in storage.
  *
  * @param PageRequest $request
  * @param  int $id
  * @return Response
  */
 public function update(PageRequest $request, $id)
 {
     Cache::forget('_pages');
     $data = $request->all();
     switch ($request->get('content_type')) {
         case "content":
             $data['component_id'] = $data['external_link'] = null;
             break;
         case "component":
             $data['content_id'] = $data['external_link'] = null;
             break;
         case "link":
             $data['content_id'] = $data['component_id'] = null;
             break;
     }
     if ($request->get('content_type') == "content" && $request->get('content_id') == "") {
         if ($content = $this->content->newContent(['title' => $request->get('create_content_title'), 'title_visibility' => $request->get('create_content_title_visibility'), 'status' => $request->get('create_content_status'), 'access' => serialize($request->get('create_content_access')), 'content' => $request->get('create_content_content')])) {
             $data['content_id'] = $content->id;
         } else {
             Flash::error('İçerik Eklenemedi ve İşlem İptal Edildi Önce Yeni İçerik Ekleyerek Sayfayı Oluşturmayı Deneyebilirsiniz');
             return redirect()->route('admin.page.index');
         }
     }
     $data['access'] = serialize($data['access']);
     if ($this->page->saveData("update", $data, $id)) {
         Logs::add('process', "Sayfa Güncellendi\nID:{$id}");
         Flash::success('Başarıyla Kaydedildi');
         return redirect()->route('admin.page.index');
     } else {
         Logs::add('errors', "Sayfa Güncellenemedi! \nID:{$id}");
         Flash::error('Bir Hata Meydana Geldi ve Kaydedilemedi');
         return redirect()->back();
     }
 }