public function store(Request $request) { $publish = 0; $private = 0; $id_parent = 0; $uri = ""; $id_menu = $request['id_menu']; if ($request['publish'] == 'on') { $publish = 1; } else { $publish = 0; } if ($request['id_parent'] != "") { $id_parent = $request['id_parent']; } /******************************************************/ switch ($request['option']) { case 'LinkTo': if ($request['uri'] != "") { $uri = $request['uri']; } break; case 'LinkToSec': $id_section = $request['id_section_menu']; $Section = \App\cms_section::find($id_section); if ($id_section > 0) { $uri = "Sec/" . $Section->uri; } break; case 'LinkToCatList': $id_section = $request['id_section_menu']; $Section = \App\cms_section::find($id_section); if ($id_section != "") { $uri = "CatList/" . $Section->uri; } break; case 'LinkToCat': $id_category = $request['id_category_menu']; $Category = \App\cms_category::find($id_category); if ($id_category > 0) { $uri = "Cat/" . $Category->uri; } break; case 'LinkToDocList': $id_category = $request['id_category_menu']; $Category = \App\cms_category::find($id_category); if ($id_category != "") { $uri = "DocList/" . $Category->uri; } break; case 'LinkToDoc': $id_document = $request['id_document_menu']; $Document = \App\cms_document::find($id_document); if ($id_document > 0) { $uri = "Doc/" . $Document->uri; } break; case 'LinkToGalList': $id_galleries = 1; $uri = "Galleries"; break; case 'LinkToGallery': $id_galleries = $request['id_galleries']; $Gallery = \App\Media::find($id_galleries); if ($id_galleries > 0) { $uri = "Gal/" . $Gallery->uri; } break; default: return null; } /*******************************************************/ $file = $request->file('file'); if ($file != "") { $path = 'store/MEN/' . uniqid() . '.' . $file->getClientOriginalExtension(); //indicamos que queremos guardar un nuevo archivo en el disco local Storage::disk('local')->put($path, File::get($file)); $ext = $file->getClientOriginalExtension(); } else { $path = ""; $ext = ""; } if ($request['ChekPrivado'] == "on") { $private = 1; } /*******************************************************/ $level = $request['level']; $size = $request['size']; //obtenemos el campo file definido en el formulario $flag = 1; $orderBy = DB::table('men_items')->where('active', '=', $flag)->where('id_menu', '=', $id_menu)->where('id_parent', '=', $id_parent)->max('order_by') + 1; \App\ItemMenu::create(['id_menu' => $id_menu, 'id_parent' => $id_parent, 'title' => $request['title'], 'description' => '', 'size' => $size, 'target' => $request['target'], 'uri' => $uri, 'img' => $path, 'ext' => $ext, 'level' => $level, 'order_by' => $orderBy, 'private' => $private, 'publish' => $publish, 'active' => '1', 'register_by' => Auth::User()->id, 'modify_by' => Auth::User()->id]); return redirect('/admin/itemmenu/' . $id_menu . '/' . $id_parent); }
public function order($id, $orderBy, $no) { // Actualizamos el registro con id $flag = 1; $this->setOrderItem($flag, $orderBy, $no); $Document = \App\cms_document::find($id); $Document->order_by = $no; $Document->save(); Session::flash('message', 'Ordén del Albúm actualizado'); return redirect('/admin/document')->with('message', 'store'); }