Exemplo n.º 1
0
 /**
  * Show the form for editing the specified pages.
  *
  * @param  int  $id
  * @return \Illuminate\View\View
  */
 public function edit($id)
 {
     $pages = Pages::find($id);
     $sitelanguages = SiteLanguages::site_access()->join('sites', function ($join) {
         $join->on('sites.id', '=', 'sitelanguages.sites_id');
     })->join('languages', 'languages.id', '=', 'sitelanguages.languages_id')->select('sitelanguages.id', \DB::raw(' CONCAT(sites.title, \'-\',languages.code) as site_language'))->get()->lists('site_language', 'id');
     $category = Category::site_access()->join('sitelanguages', 'sitelanguages.id', '=', 'category.sitelanguages_id')->join('languages', 'languages.id', '=', 'sitelanguages.languages_id')->join('sites', 'sites.id', '=', 'sitelanguages.sites_id')->select('category.id', 'category.title')->get()->lists('title', 'id')->prepend('Please select', '');
     return view('admin.pages.edit', compact('pages', 'sitelanguages', 'category'));
 }
 public function putEdit(Request $request)
 {
     if (!ACL::hasPermission('pages', 'edit')) {
         return redirect(route('pages'))->withErrors(['Você não tem permissão para editar as páginas.']);
     }
     $this->validate($request, ['description' => 'required|max:200', 'keywords' => 'required'], ['description.required' => 'Informe a descrição da página', 'description.max' => 'A descrição da página não pode ter mais de :max caracteres', 'keyword.required' => 'Informe as palavras-chave da página']);
     $pages = Pages::find($request->pagesId);
     $pages->description = $request->description;
     $pages->keywords = $request->keywords;
     $pages->save();
     $success = "Página editada com sucesso!";
     return redirect(route('pages'))->with(compact('success'));
 }
Exemplo n.º 3
0
 public function destroy($id)
 {
     Pages::find($id)->delete();
     return redirect_success('Admin\\PagesController@index', Lang::get('messages.delete_success'));
 }
Exemplo n.º 4
0
 public function postEditPage(Request $request, $id)
 {
     $page = Pages::find($id);
     $page->title = $request->title;
     $page->slug = $request->slug;
     $page->contant = $request->editor;
     if ($page->save()) {
         return redirect('/dashboard/pages');
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $page = Pages::find($id);
     $page->delete();
     // redirect
     \Session::flash('message', 'Successfully deleted!!');
     return \Redirect::to('admin/pages');
 }
Exemplo n.º 6
0
 public function changePosition(Request $request)
 {
     $id = $request->input('itemID');
     $position = $request->input('itemIndex');
     $page = Pages::find($id);
     $page->position = $position;
     $page->save();
     return 'success';
 }