本文整理汇总了PHP中app\Menu类的典型用法代码示例。如果您正苦于以下问题:PHP Menu类的具体用法?PHP Menu怎么用?PHP Menu使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Menu类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return Response
*/
public function store(Request $request, \App\Menu $menu)
{
$validation = \Validator::make($request->all(), ['name' => 'required|min:3']);
if ($validation->fails()) {
return response($validation->errors()->all(), 400);
}
$category = new \App\Category($request->all());
$menu->categories()->save($category);
$category->savePhoto($request->file('photo'));
return $category;
}
示例2: add
public function add()
{
$input = Request::all();
$menu = new Menu();
$menu->menu = $input['menu_nombre'];
$menu->url = $input['menu_url'];
$menu->padre_id = $input['menu_padre_id'];
$menu->save();
return redirect('listMenu');
//->back();
}
示例3: __construct
public function __construct(Menu $menuModel, MenuImage $menuImage, Category $category, Footer $footer, Components $components)
{
$this->data = [];
$category = $category->getActive();
$leftMenu = $menuModel->getLeftMenu();
$rightMenu = $menuModel->getRightMenu();
$MenuImage = $menuImage->getActive();
$footer = $footer->getActive();
$components = $components->getComponents();
$bascedCount = Session::get('bascedCount');
$this->data = ['leftMenu' => $leftMenu, 'rightMenu' => $rightMenu, 'menuImage' => $MenuImage, 'category' => $category, 'footer' => $footer[0], 'components' => $components[0], 'bascedCount' => $bascedCount];
}
示例4: handle
/**
* Execute the command.
*
* @return void
*/
public function handle()
{
$slug = Slug::create(['name' => $this->request->slug, 'slug_attribute_id' => self::SLUG_ATTRIBUTE_MENU]);
$this->request['slug_id'] = $slug->id;
$menu = new Menu($this->request->all());
$menu->generateOrder();
if ($menu->location_id == 0) {
$parent = Menu::findOrFail($menu->parent_id);
$menu->location_id = $parent->location_id;
}
$menu->save();
Activity::create(['text' => $this->auth->linkedName() . ' created new menu named ' . $menu->linkedName(), 'user_id' => $this->auth->id]);
Session::flash('flash_message', 'Your menu has been created!');
}
示例5: __construct
public function __construct()
{
// Carbon Language
Carbon::setLocale('tr');
// create home page if non exist
count(Menu::where('slug', '/anasayfa')->get()) == 0 ? Menu::create(['title' => 'Anasayfa', 'slug' => '/anasayfa', 'eng_title' => 'Home', 'eng_slug' => '/home'])->save() : null;
// create config file if non exist
!\File::exists(storage_path('.config')) ? \File::put(storage_path('.config'), json_encode(['brand' => 'Brand Name', 'mail' => 'info@brand.com', 'active' => 1, 'eng' => '0', 'one_page' => '0', 'googlemap' => '', 'header' => ''])) : null;
$this->config = json_decode(\File::get(storage_path('.config')));
!\File::exists(storage_path('app/custom/css')) ? \File::makeDirectory(storage_path('app/custom/css'), 0755, true) : null;
!\File::exists(storage_path('app/custom/js')) ? \File::makeDirectory(storage_path('app/custom/js'), 0755, true) : null;
// get css & js files from custom folder
// css
$css = \File::allFiles(storage_path('app/custom/css'));
if (!empty($css)) {
foreach ($css as $cs) {
$this->css[$cs->getCtime()] = $cs->getRelativePathname();
}
// sort by date
ksort($this->css);
}
// js
$js = \File::allFiles(storage_path('app/custom/js'));
if (!empty($js)) {
foreach ($js as $j) {
$this->js[$j->getCtime()] = $j->getRelativePathname();
}
// sort by date
ksort($this->js);
}
}
示例6: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$menus = [['id' => 1, 'slug' => 'coding', 'title' => 'Coding', 'parent' => 0, 'level' => 0], ['id' => 2, 'slug' => 'magento', 'title' => 'Magento', 'parent' => 1, 'level' => 1], ['id' => 3, 'slug' => 'git', 'title' => 'Git', 'parent' => 1, 'level' => 1], ['id' => 4, 'slug' => 'laravel', 'title' => 'Laravel', 'parent' => 1, 'level' => 1], ['id' => 5, 'slug' => 'civil', 'title' => 'Civil', 'parent' => 0, 'level' => 0], ['id' => 6, 'slug' => 'economics', 'title' => 'Economics', 'parent' => 5, 'level' => 1], ['id' => 7, 'slug' => 'epw', 'title' => 'EPW', 'parent' => 6, 'level' => 2], ['id' => 8, 'slug' => 'macroeconomics', 'title' => 'Macroeconomics XII', 'parent' => 6, 'level' => 2], ['id' => 9, 'slug' => 'class_notes', 'title' => 'Class Notes', 'parent' => 6, 'level' => 2], ['id' => 10, 'slug' => 'geography', 'title' => 'Geography', 'parent' => 5, 'level' => 1], ['id' => 11, 'slug' => 'history', 'title' => 'History', 'parent' => 5, 'level' => 1]];
foreach ($menus as $menu) {
Menu::create($menu);
}
}
示例7: setupLayout
/**
* Setup the layout used by the controller.
*
* @return void
*/
protected function setupLayout()
{
if (!is_null($this->layout)) {
$this->layout = view($this->layout);
$this->layout->menus = Menu::getMenu();
}
}
示例8: Parallax
public function Parallax()
{
$menus = Menu::roots()->get();
$menu = Menu::where('slug', '/anasayfa')->first();
\Activity::log('Ziyaret: Anasayfa (Tek Sayfa Site)');
return view('parallax')->with(['menus' => $menus, 'menu' => $menu]);
}
示例9: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$package_rule = PackageRule::findOrFail($id);
$menus = Menu::orderBy('name')->notMainCourse()->lists('name', 'id');
$package = $package_rule->package()->first();
return view('admin.packages.modals.package_rules._edit_package_rule', compact('package_rule', 'package', 'menus'));
}
示例10: show
public function show($id)
{
$menu = Menu::where('fecha', '2015-11-7')->first();
$relaciones = $menu->menu_platos;
foreach ($relaciones as $relacion) {
switch ($relacion->plato->tipo->id) {
case 1:
$entradas[] = $relacion->plato;
break;
case 2:
$segundos[] = $relacion->plato;
break;
case 3:
$postres[] = $relacion->plato;
break;
case 4:
$bebidas[] = $relacion->plato;
break;
}
}
switch ($id) {
case 1:
return $entradas;
case 2:
return $segundos;
case 3:
return $postres;
case 4:
return $bebidas;
}
}
示例11: showAgenda
public function showAgenda($slug)
{
$data['menuse'] = Menu::orderBy('id')->get()->keyBy('id');
$data['agenda5'] = Agenda::orderBy('id', 'desc')->take(4)->get();
$data['footers'] = Footer::orderBy('id')->get()->keyBy('id');
$data['post'] = Agenda::where('slug', '=', $slug)->firstOrFail();
return view('agenda.showAgenda')->with('data', $data);
}
示例12: create
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create()
{
$permisos = \App\Menu::all()->lists('nombre', 'id');
$nivel_usuario = \App\UserLevel::all()->lists('UserLevelName', 'UserLevelID');
/*array_unshift($nivel_usuario,'Seleccione un nivel de usuario');*/
array_unshift($permisos, 'Seleccione una opcion del menu');
return view('permisos.crear')->with(['permisos' => $permisos, 'userlevel' => $nivel_usuario]);
}
示例13: __construct
public function __construct()
{
$this->menus = Menu::where('pid', '=', '0')->orderBy('odnum', 'asc')->get();
//主菜单
$this->pidmenus = Menu::where('pid', '!=', '0')->orderBy('odnum', 'asc')->get();
//子菜单
View::share(['menus' => $this->menus, 'pidmenus' => $this->pidmenus]);
}
示例14: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$menu = Menu::find($id);
$menu->fill($request->all());
$menu->save();
Session::flash('message', 'Data Telah di Update');
return Redirect::to('/menu');
}
示例15: postQuickUpdate
public function postQuickUpdate()
{
$inputs = Input::all();
$menu = Menu::find($inputs['pk']);
$menu->{$inputs}['name'] = $inputs['value'];
Log::info("menu save" . $menu->id . " " . $menu->name);
$menu->save();
return "test";
}