public function deleteNom() { $name = $this->schoolname; if ($name != null) { $this->schoolname = null; Variable::where('key', '=', 'ECOLE_NOM')->delete(); Session::flash('flash_success', 'Le nom "' . $name . '" a été supprimé.'); } else { Session::flash('flash_error', 'Une erreur s\'est produite, aucun nom ne correspond dans nos données.'); } return redirect(route('admin_identite_ecole_get', ['nom' => null, 'logo' => $this->filename])); }
public function getAdminTable(Request $r) { $items = array(); $query = $r->input("query", ""); $sort = $r->input("sort", "id"); $asc = "DESC"; if ($sort == "old" || $sort == "title") { $asc = "ASC"; } if ($sort != "title") { $sort = "id"; } switch ($r->input("entity")) { case "contents": $items = Content::where("type", $r->input("type"))->where("title", "like", "%" . $query . "%")->orderBy($sort, $asc)->simplePaginate(10); break; case "members": $items = Member::where("firstname", "like", "%" . $query . "%")->orWhere("lastname", "like", "%" . $query . "%")->orderBy($sort, $asc)->simplePaginate(10); break; case "variables": $items = Variable::where("title", "like", "%" . $query . "%")->orderBy($sort, $asc)->simplePaginate(10); break; case "tags": $items = Tag::where("title", "like", "%" . $query . "%")->orderBy($sort, $asc)->simplePaginate(20); break; case "categories": $catcon = new CategoryController(); $items = $catcon->getTree(); break; default: echo "unknown type"; } return view('admintable', ['type' => $r->input('type'), 'entity' => $r->input('entity'), 'items' => $items]); }