本文整理汇总了PHP中Menu::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Menu::create方法的具体用法?PHP Menu::create怎么用?PHP Menu::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Menu
的用法示例。
在下文中一共展示了Menu::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Menu::create(array('id' => 1, 'title' => 'User Manager', 'url' => '#', 'role_id' => 1, 'parent' => 0));
Menu::create(array('id' => 2, 'title' => 'Users', 'url' => 'users', 'role_id' => 1, 'parent' => 1));
Menu::create(array('id' => 3, 'title' => 'Role', 'url' => 'roles', 'role_id' => 1, 'parent' => 1));
Menu::create(array('id' => 4, 'title' => 'Setting', 'url' => '#', 'role_id' => 1, 'parent' => 0));
Menu::create(array('id' => 5, 'title' => 'Menu Manager', 'url' => 'menu', 'role_id' => 1, 'parent' => 4));
}
示例2: run
public function run()
{
// 清空数据
DB::table('menus')->truncate();
//填充预设菜单
$home = Menu::create(array('title' => '首页', 'pid' => 0, 'name' => 'admin.index.index'));
$content = Menu::create(array('title' => '内容', 'pid' => 0));
//文章权限
$article = Menu::create(array('title' => '文章管理', 'pid' => $content->id, 'name' => 'admin.article.index'));
Menu::create(array('title' => '新建', 'pid' => $article->id, 'name' => 'admin.article.create'));
Menu::create(array('title' => '保存新建', 'pid' => $article->id, 'name' => 'admin.article.store'));
Menu::create(array('title' => '编辑', 'pid' => $article->id, 'name' => 'admin.article.edit'));
Menu::create(array('title' => '保存编辑', 'pid' => $article->id, 'name' => 'admin.article.update'));
Menu::create(array('title' => '批量操作', 'pid' => $article->id, 'name' => 'admin.article.batch'));
//单页权限
$page = Menu::create(array('title' => '单页面管理', 'pid' => $content->id, 'name' => 'admin.page.index'));
Menu::create(array('title' => '新建', 'pid' => $page->id, 'name' => 'admin.page.create'));
Menu::create(array('title' => '保存新建', 'pid' => $page->id, 'name' => 'admin.page.store'));
Menu::create(array('title' => '编辑', 'pid' => $page->id, 'name' => 'admin.page.edit'));
Menu::create(array('title' => '保存编辑', 'pid' => $page->id, 'name' => 'admin.page.update'));
Menu::create(array('title' => '批量操作', 'pid' => $page->id, 'name' => 'admin.page.batch'));
$usermanage = Menu::create(array('title' => '用户', 'pid' => 0));
//用户管理权限
$user = Menu::create(array('title' => '用户管理', 'pid' => $usermanage->id, 'name' => 'admin.user.index'));
Menu::create(array('title' => '新建', 'pid' => $user->id, 'name' => 'admin.user.create'));
Menu::create(array('title' => '保存新建', 'pid' => $user->id, 'name' => 'admin.user.store'));
Menu::create(array('title' => '编辑', 'pid' => $user->id, 'name' => 'admin.user.edit'));
Menu::create(array('title' => '保存编辑', 'pid' => $user->id, 'name' => 'admin.user.update'));
Menu::create(array('title' => '批量操作', 'pid' => $user->id, 'name' => 'admin.user.batch'));
//用户组
$group = Menu::create(array('title' => '用户组管理', 'pid' => $usermanage->id, 'name' => 'admin.group.index'));
Menu::create(array('title' => '新建', 'pid' => $group->id, 'name' => 'admin.group.create'));
Menu::create(array('title' => '保存新建', 'pid' => $group->id, 'name' => 'admin.group.store'));
Menu::create(array('title' => '编辑', 'pid' => $group->id, 'name' => 'admin.group.edit'));
Menu::create(array('title' => '保存编辑', 'pid' => $group->id, 'name' => 'admin.group.update'));
Menu::create(array('title' => '批量操作', 'pid' => $group->id, 'name' => 'admin.group.batch'));
$system = Menu::create(array('title' => '系统', 'pid' => 0));
$menu = Menu::create(array('title' => '菜单管理', 'pid' => $system->id, 'name' => 'admin.menu.index'));
Menu::create(array('title' => '新建', 'pid' => $menu->id, 'name' => 'admin.menu.create'));
Menu::create(array('title' => '保存新建', 'pid' => $menu->id, 'name' => 'admin.menu.store'));
Menu::create(array('title' => '编辑', 'pid' => $menu->id, 'name' => 'admin.menu.edit'));
Menu::create(array('title' => '保存编辑', 'pid' => $menu->id, 'name' => 'admin.menu.update'));
Menu::create(array('title' => '批量操作', 'pid' => $menu->id, 'name' => 'admin.menu.batch'));
$category = Menu::create(array('title' => '分类管理', 'pid' => $system->id, 'name' => 'admin.category.index'));
Menu::create(array('title' => '新建', 'pid' => $category->id, 'name' => 'admin.category.create'));
Menu::create(array('title' => '保存新建', 'pid' => $category->id, 'name' => 'admin.category.store'));
Menu::create(array('title' => '编辑', 'pid' => $category->id, 'name' => 'admin.category.edit'));
Menu::create(array('title' => '保存编辑', 'pid' => $category->id, 'name' => 'admin.category.update'));
Menu::create(array('title' => '批量操作', 'pid' => $category->id, 'name' => 'admin.category.batch'));
$option = Menu::create(array('title' => '站点设置', 'pid' => $system->id, 'name' => 'admin.option.index'));
Menu::create(array('title' => '保存', 'pid' => $option->id, 'name' => 'admin.option.save'));
$systool = Menu::create(array('title' => '系统工具', 'pid' => $system->id, 'name' => 'admin.systool.index'));
Menu::create(array('title' => '缓存清理', 'pid' => $systool->id, 'name' => 'admin.systool.flushcache'));
}
示例3: store
public function store()
{
$input = Input::all();
$last_menu_item = Menu::orderBy('order', 'DESC')->first();
if (isset($last_menu_item->order)) {
$new_menu_order = intval($last_menu_item->order) + 1;
} else {
$new_menu_order = 1;
}
$input['order'] = $new_menu_order;
$menu = Menu::create($input);
if (isset($menu->id)) {
return Redirect::to('admin/menu')->with(array('note' => 'Successfully Added New Menu Item', 'note_type' => 'success'));
}
}
示例4: __construct
/**
*
*/
public function __construct(Gw2Account $account = null)
{
$trans = Translator::getInstance();
// GENERAL
$menu = Menu::create($trans['menu.general']);
$menu->addItem('account', $trans['menu.general.account']);
$menu->addItem('wallet', $trans['menu.general.wallet'])->setPermission(Gw2Account::PERMISSION_WALLET);
$menu->addItem('golds', $trans['menu.general.golds']);
$menu->addItem('search', $trans['menu.general.search']);
$menu->addItem('pvp', $trans['menu.general.pvp'])->setPermission(Gw2Account::PERMISSION_PVP);
$menu->addItem('statistics', $trans['menu.general.statistics']);
$this->addMenu($menu);
// CHARACTERS
$menu = Menu::create($trans['menu.characters']);
$menu->addItem('characters', $trans['menu.characters.characters']);
$menu->addItem('equipments', $trans['menu.characters.equipments']);
$menu->addItem('inventories', $trans['menu.characters.inventories'])->setPermission(Gw2Account::PERMISSION_INVENTORIES);
$menu->addItem('attributes', $trans['menu.characters.attributes']);
$menu->addItem('builds', $trans['menu.characters.builds'])->setPermission(Gw2Account::PERMISSION_BUILDS);
if ($account) {
$menu->addSeparator();
foreach ($account->getCharacterNames() as $name) {
$menu->addItem('character/' . $name, $name, 'character/' . $name);
}
}
$this->addMenu($menu);
// VAULTS
$menu = Menu::create($trans['menu.vaults']);
$menu->addItem('bank', $trans['menu.vaults.bank'])->setPermission(Gw2Account::PERMISSION_INVENTORIES);
$menu->addItem('collectibles', $trans['menu.vaults.collectibles'])->setPermission(Gw2Account::PERMISSION_INVENTORIES);
$this->addMenu($menu);
// UNLOCKS
$menu = Menu::create($trans['menu.unlocks']);
$menu->addItem('wardrobe_armors', $trans['menu.unlocks.wardrobe_armors'])->setPermission(Gw2Account::PERMISSION_UNLOCKS);
$menu->addItem('wardrobe_weapons', $trans['menu.unlocks.wardrobe_weapons'])->setPermission(Gw2Account::PERMISSION_UNLOCKS);
$menu->addItem('dyes', $trans['menu.unlocks.dyes'])->setPermission(Gw2Account::PERMISSION_UNLOCKS);
$menu->addItem('minis', $trans['menu.unlocks.minis'])->setPermission(Gw2Account::PERMISSION_UNLOCKS);
$this->addMenu($menu);
// TRADING POST
$menu = Menu::create($trans['menu.tp']);
$menu->addItem('tp_buys', $trans['menu.tp.tp_buys'])->setPermission(Gw2Account::PERMISSION_TRADINGPOST);
$menu->addItem('tp_sells', $trans['menu.tp.tp_sells'])->setPermission(Gw2Account::PERMISSION_TRADINGPOST);
$this->addMenu($menu);
// ACHIEVMENTS
$menu = Menu::create($trans['menu.achievements']);
$menu->addItem('achievements_daily', $trans['menu.achievements.daily']);
$this->addMenu($menu);
}
示例5: addMenuSlider
public function addMenuSlider()
{
$rules = array('title' => 'required', 'image' => 'required|image');
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator->getMessageBag());
}
// save the image
$file = Input::file('image');
$image_name = str_random(10);
$image_extension = $file->getClientOriginalExtension();
$img = Image::make($file->getRealPath())->resize(1349, 665);
$img->save(public_path() . '/img/sliderImages/' . $image_name . '.' . $image_extension);
Menu::create(array('image' => $image_name . '.' . $image_extension, 'title' => Input::get('title')));
return Redirect::back();
}
示例6: add_post
public function add_post()
{
$valid = Validator::make(Input::all(), Menu::$rule_add_menu, Menu::$menu_langs);
if ($valid->passes()) {
$data = Input::all();
$img = $data['menu_image'];
$isUpload = $img->move("uploads/menu/images/", $img->getClientOriginalName());
if ($isUpload) {
$data = array("menu_name" => Input::get("menu_name"), "menu_description" => Input::get("menu_description"), "menu_image" => $img->getClientOriginalName(), "menu_created_at" => Input::get("menu_created_at"));
Menu::create($data);
return Redirect::route("manage_menu_add_get")->with("flash_success", "Chúc mừng bạn đã thêm thực đơn thành công");
}
return Redirect::route("manage_menu_add_get")->with("flash_success", "Không thể upload ảnh");
}
return Redirect::route("manage_menu_add_get")->withInput()->with("flash_error", $valid->errors()->first());
}
示例7: run
public function run()
{
$admin = Role::where('name', '=', 'admin')->firstOrFail();
$guest = Role::where('name', '=', 'guest')->firstOrFail();
$user = Role::where('name', '=', 'user')->firstOrFail();
$master = Role::where('name', '=', 'master')->firstOrFail();
Menu::create(['name' => 'home', 'description' => 'show the principal page', 'image' => '', 'title' => 'Home', 'route' => '/']);
Menu::create(['name' => 'profile', 'description' => 'provide a page to change the user profile', 'image' => '', 'title' => 'Profile', 'route' => 'profile']);
Menu::create(['name' => 'login', 'description' => 'provide a page to make a login or sign up', 'image' => '', 'title' => 'Login', 'route' => 'login']);
Menu::create(['name' => 'logout', 'description' => 'make a logout if a user is login', 'image' => '', 'title' => 'Logout', 'route' => 'logout']);
$login = Menu::where('name', '=', 'login')->firstOrFail();
$profile = Menu::where('name', '=', 'profile')->firstOrFail();
$home = Menu::where('name', '=', 'home')->firstOrFail();
$logout = Menu::where('name', '=', 'logout')->firstOrFail();
$login->roles()->attach($guest->id);
$profile->roles()->sync(array($admin->id, $user->id, $master->id));
$home->roles()->sync(array($guest->id, $admin->id, $user->id, $master->id));
$logout->roles()->sync(array($admin->id, $user->id, $master->id));
}
示例8: display
public function display()
{
$template = new Template();
$template->load("menu_new");
$template->show_if("NOTSUCCEEDED", isset($_POST['name']) == false);
$template->show_if("SUCCEEDED", false);
if ($_GET['blank'] == true) {
$template->assign_var("URL", UrlRewriting::GetUrlByAlias("admin/newmenu", "blank=true"));
} else {
$template->assign_var("URL", UrlRewriting::GetUrlByAlias("admin/newmenu"));
}
if (isset($_POST['name'])) {
$template->show_if("SUCCEEDED", true);
$id = Menu::create($_POST['name'], $_SESSION['dir']);
if (!$id) {
$template->load("message");
$template->assign_var("MESSAGE", Language::DirectTranslate("MENU_NOT_CREATED"));
}
}
$template->output();
}
示例9: valid
Author : BCH
Date : 2016.02.22
*/
require_once dirname(__FILE__) . '/' . 'utility.php';
require_once dirname(__FILE__) . '/' . 'menu.php';
require_once dirname(__FILE__) . '/' . 'SaeMysql.php';
require_once dirname(__FILE__) . '/' . 'CCInterface.php';
//define your token
//define("TOKEN", "ZhuanYangQian");
$wechatMenu = new Menu();
//$wechatMenu->delete();
$errCode = $wechatMenu->view();
if (0 != $errCode) {
//$wechatMenu->delete();
//$wechatMenu->view();
$ret = $wechatMenu->create();
sae_debug($ret);
exit;
}
//exit;
$wechatObj = new wechatCallbackapiTest();
if (isset($_GET['echostr'])) {
$wechatObj->valid();
} else {
sae_debug("responseMsg ok!");
$wechatObj->responseMsg();
}
class wechatCallbackapiTest
{
public function valid()
{
示例10: function
<?php
Menu::group(trans('acl::permission.menu_permissions'), 'fa-lock', function ($parent) {
Menu::create('roles.list', trans('acl::permission.menu_roles'))->setParent($parent)->setPermission('add_remove_permission_to_role');
})->setOrder(5);
示例11: function
<?php
Menu::create('admin-menu', function ($menu) {
$menu->enableOrdering();
$menu->setPresenter('Mrzeta\\Admin\\Presenters\\SidebarMenuPresenter');
$menu->route('admin.home', trans('admin.menus.dashboard'), [], 0, ['icon' => 'fa fa-dashboard']);
$menu->dropdown(trans('admin.menus.articles.title'), function ($sub) {
$sub->route('admin.articles.index', trans('admin.menus.articles.all'), [], 1);
$sub->route('admin.articles.create', trans('admin.menus.articles.create'), [], 2);
$sub->divider(3);
$sub->route('admin.categories.index', trans('admin.menus.categories'), [], 4);
}, 1, ['icon' => 'fa fa-book']);
$menu->dropdown(trans('admin.menus.pages.title'), function ($sub) {
$sub->route('admin.pages.index', trans('admin.menus.pages.all'), [], 1);
$sub->route('admin.pages.create', trans('admin.menus.pages.create'), [], 2);
}, 2, ['icon' => 'fa fa-flag']);
$menu->dropdown(trans('admin.menus.users.title'), function ($sub) {
$sub->route('admin.users.index', trans('admin.menus.users.all'), [], 1);
$sub->route('admin.users.create', trans('admin.menus.users.create'), [], 2);
$sub->divider(3);
$sub->route('admin.roles.index', trans('admin.menus.roles'), [], 4);
$sub->route('admin.permissions.index', trans('admin.menus.permissions'), [], 5);
}, 3, ['icon' => 'fa fa-users']);
});
示例12: function
<?php
Menu::create('admin-menu', function ($menu) {
if (Auth::check()) {
$menu->setPresenter('Pingpong\\Admin\\Presenters\\SidebarMenuPresenter');
$menu->route('admin.home', 'Dashboard', [], ['icon' => 'fa fa-dashboard']);
if (Auth::user()->is('admin')) {
$menu->dropdown('Users', function ($sub) {
$sub->route('admin.users.index', 'All Users');
$sub->route('admin.users.create', 'Add New User');
$sub->divider();
$sub->route('admin.roles.index', 'Roles');
$sub->route('admin.permissions.index', 'Permissions');
}, ['icon' => 'fa fa-users']);
}
if (Auth::user()->is('manager') or Auth::user()->is('admin')) {
$menu->dropdown('Projects', function ($sub) {
$sub->route('admin.projects.index', 'All Projects');
$sub->route('admin.projects.create', 'Add New Project');
}, ['icon' => 'fa fa-th']);
}
if (Auth::user()) {
$menu->dropdown('Defects', function ($sub) {
$sub->route('admin.defects.index', 'All Defects');
$sub->route('admin.defects.create', 'Add New Defect');
$sub->route('admin.defects.self', 'My Defects');
$sub->route('admin.defects.assigned', 'Assigned To Me');
}, ['icon' => 'glyphicon glyphicon-exclamation-sign']);
}
}
});
示例13: function
<?php
Menu::group(trans('employees::employee.menu_employees'), 'fa-briefcase', function ($parent) {
Menu::create('employees.list', trans('employees::employee.menu_employee_list'))->setParent($parent)->setPermission('list_employees');
Menu::create('employee.new', trans('employees::employee.menu_employee_new'))->setParent($parent)->setPermission('create_employee');
Menu::group(function ($parent) {
Menu::create('employee_categories.list', trans('employees::employee_category.menu_categories'))->setParent($parent)->setPermission('list_employee_cetegories');
Menu::create('employee_positions.list', trans('employees::employee_position.menu_positions'))->setParent($parent)->setPermission('list_employee_positions');
Menu::create('employee_grades.list', trans('employees::employee_grade.menu_grades'))->setParent($parent)->setPermission('list_employee_grades');
Menu::create('employee_departments.list', trans('employees::employee_department.menu_departments'))->setParent($parent)->setPermission('list_employee_departments');
})->setParent($parent);
})->setOrder(3);
示例14: function
<?php
Menu::group(trans('students::student.menu_students'), 'fa-users', function ($parent) {
Menu::create('students.list', trans('students::student.menu_students_list'))->setParent($parent)->setPermission('list_students');
Menu::create('student.new', trans('students::student.menu_student_new'))->setParent($parent)->setPermission('create_student');
Menu::group(function ($parent) {
Menu::create('guardians.list', trans('students::guardian.menu_guardians'))->setParent($parent)->setPermission('list_guardians');
})->setParent($parent);
Menu::group(function ($parent) {
Menu::create('student_categories.list', trans('students::student_category.menu_categories'))->setParent($parent)->setPermission('list_student_categories');
})->setParent($parent);
})->setOrder(2);
示例15: function
<?php
Menu::group(trans('classes::class.menu_classes'), 'fa-graduation-cap', function ($parent) {
Menu::create('batches.list', trans('classes::batch.menu_batches'))->setParent($parent)->setPermission('list_batches');
Menu::create('grades.list', trans('classes::grade.menu_grades'))->setParent($parent)->setPermission('list_grades');
})->setOrder(1);