本文整理汇总了PHP中app\models\Menu类的典型用法代码示例。如果您正苦于以下问题:PHP Menu类的具体用法?PHP Menu怎么用?PHP Menu使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Menu类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct(LaravelFacebookSdk $fb, Menu $menu, ProjectRepository $project_repo)
{
$this->middleware('auth');
$this->menuItems = $menu->where('active', '1')->orderBy('weight', 'asc')->get();
$this->login_url = $fb->getLoginUrl(['email']);
$this->project_repo = $project_repo;
}
示例2: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$menu = new Menu();
$menu->event_id = 1;
$menu->menu_name = "Test Menu";
$menu->save();
}
示例3: __construct
/**
* Create a new authentication controller instance.
*
* @param \Illuminate\Contracts\Auth\Guard $auth
* @param \Illuminate\Contracts\Auth\Registrar $registrar
* @return void
*/
public function __construct(Guard $auth, Registrar $registrar, Menu $menu)
{
$this->auth = $auth;
$this->registrar = $registrar;
$this->menuItems = $menu->where('active', '1')->orderBy('weight', 'asc')->get();
$this->middleware('guest', ['except' => 'getLogout']);
}
示例4: __construct
public function __construct(Menu $menuModel, Slider $slider)
{
$this->data['menu']['left'] = $menuModel->getLeftMenu();
$this->data['menu']['right'] = $menuModel->getRightMenu();
$this->data['slider'] = $slider->getActive();
$URL = $_SERVER['REQUEST_URI'];
$this->data['url_lang'] = substr($URL, 1, 2);
}
示例5: __construct
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct(LaravelFacebookSdk $fb, Menu $menu, UserRepository $userrepo, ProjectRepository $project_repo)
{
$this->middleware('auth');
$this->menuItems = $menu->where('active', '1')->orderBy('weight', 'asc')->get();
$this->login_url = $fb->getLoginUrl(['email']);
$this->userrepo = $userrepo;
$this->project_repo = $project_repo;
$id = Auth::user()->id;
$userProfile = Profile::where('user_id', $id)->first();
$errorNotification = '0';
if ($userProfile->f_name == '' || $userProfile->l_name == '' || $userProfile->dob == '0000-00-00' || $userProfile->about_me == '' || $userProfile->first_address == '' || $userProfile->alternate_address == '' || $userProfile->state == '' || $userProfile->zipcode == '' || $userProfile->user_avtar == '') {
$errorNotification = '1';
}
$this->errorNotification = $errorNotification;
}
示例6: update
public function update(Request $request, $menuId)
{
$info = $request->only('info');
$menu = Menu::find($menuId);
$menu->update($info['info']);
return view('message', ['msg' => '操作成功', 'redirect' => route('menus.index')]);
}
示例7: __construct
/**
* Display a listing of the resource.
*
* @return Response
*/
public function __construct()
{
$setting = Models\Setting::first();
$this->data['menu'] = Models\Menu::with('child')->where('level', 0)->get();
$this->data['berita'] = Models\Berita::orderBy('id_berita', 'desc')->limit(6)->get();
$this->data['pengumuman'] = Models\Pengumuman::orderBy('tanggal', 'desc')->limit(10)->get();
$this->data['agenda'] = Models\Agenda::orderBy('tgl_posting', 'desc')->limit(5)->get();
$this->data['polling'] = Models\Polling::with('jawaban')->where('status', 'Y')->limit(1)->first();
$this->data['title'] = $setting->title_web;
$this->data['desc'] = $setting->desc_web;
$this->data['key'] = $setting->key_web;
$this->data['logo'] = $setting->logo;
$this->data['header_img'] = $setting->bg_header;
$this->data['icon'] = $setting->favicon;
$this->data['facebook'] = $setting->facebook;
$this->data['peta_latitude'] = $setting->peta_latitude;
$this->data['peta_longitude'] = $setting->peta_longitude;
$this->data['twitter'] = $setting->twitter;
$this->data['gplus'] = $setting->gplus;
$this->data['slider_home'] = Models\Berita::orderBy('tanggal', 'desc')->limit(5)->get();
$this->data['galeri_home'] = Models\Foto::OrderBy('id_foto', 'desc')->paginate(9);
$this->data['opini_home'] = Models\Berita::where('kategori_berita', 5)->orderBy('id_berita', 'desc')->limit(6)->get();
$this->data['banner'] = Models\Banner::where('id', 1)->first();
$this->data['link'] = Models\Link::orderBy('id', 'desc')->limit(5)->get();
$this->data['publikasi'] = Models\Publikasi::orderBy('id', 'desc')->limit(3)->get();
$this->data['setting'] = $setting;
}
示例8: boot
public function boot()
{
view()->composer('*', function ($view) {
$menuId = request()->get('menuid');
$routeName = app('router')->currentRouteName();
if (empty($menuId)) {
$menuId = app('menu')->select('id')->where('route', '=', $routeName)->first()['id'];
}
$params = ['submenus' => [], 'route_name' => $routeName, 'menuid' => $menuId];
if (!empty($menuId)) {
$menus = Menu::all();
$submenus = [];
foreach ($menus as $menu) {
if ($menu['parentid'] == $menuId) {
$submenus[] = $menu;
}
if ($menu['id'] == $menuId) {
$p = $menu;
}
}
array_unshift($submenus, $p);
$params['submenus'] = $submenus;
}
$view->with($params);
});
}
示例9: compose
/**
* 将数据绑定到视图。
*
* @param View $view
* @return void
*/
public function compose(View $view)
{
//查询当前登录用户
$admin = Auth::guard('admin')->user();
if ($admin->admin_name == 'admin') {
$menus = Menu::orderBy('sort', 'ASC')->get()->toTree();
} else {
if ($admin->role) {
$ids = DB::table('sys_role_function')->where('sys_role_id', $admin->role[0]->id)->pluck('sys_fun_id');
$menus = Menu::orderBy('sort', 'ASC')->whereIn('id', $ids)->get()->toTree();
}
}
$currentRoute = Route::currentRouteName();
$list = explode('.', $currentRoute);
$route = '';
for ($i = 0; $i < count($list) - 1; $i++) {
if ($i == 0) {
$route .= $list[$i];
} else {
$route .= '.' . $list[$i];
}
}
$route = $route . '.index';
$view->with('currentRoute', $route)->with('trees', $menus);
}
示例10: run
public function run()
{
$menu = Menu::find()->where(['position' => 'bottom'])->one();
$p = explode(',', $menu->content);
$model = Page::find()->where(['id' => $p])->all();
return $this->render('links', ['pages' => $model]);
}
示例11: getChildMenu
public static function getChildMenu($ParentId, $ParentLabel)
{
$menuData = Menu::find()->where(['ismenu' => TRUE, 'status' => TRUE, 'parentid' => $ParentId, 'isweb' => FALSE])->orderBy('orderby')->all();
$submenu = array();
$menu = array();
if (!empty($menuData)) {
foreach ($menuData as $mKey => $mValue) {
$menu['label'] = Html::tag('i', '', ['class' => $mValue['labelicon']]) . Html::encode($mValue['label']);
$urlArray = [$mValue['module'], $mValue['controller'], $mValue['action']];
$menu['url'] = \Yii::$app->urlManager->createUrl(implode('/', $urlArray));
$class = '';
if (\Yii::$app->controller->id == $urlArray[1] && \Yii::$app->controller->action->id == $urlArray[2]) {
$class = 'active';
\Yii::$app->params['breadcrumbs'][] = $ParentLabel;
\Yii::$app->params['breadcrumbs'][] = $mValue['label'];
}
$menu['options'] = ['class' => $class];
$submenu[$mValue['orderby']] = $menu;
unset($menu, $urlArray);
}
// $submenu['options'] = ['class' => 'children'];
}
return $submenu;
//, 'options' => ['class' => 'children']];
}
示例12: destroy
public function destroy($id)
{
//
$data = Menu::find($id);
if ($data->delete()) {
return response()->json(array('success' => TRUE, 'msg' => 'Data Berhasil Dihapus'));
}
}
示例13: content
public function content($slug)
{
$menu_item = Menu::where('url', $slug);
if ($menu_item->count()) {
return view('home.content', ['menu_item' => $menu_item->first()]);
}
return view('errors.404');
}
示例14: __construct
/**
* Display a listing of the resource.
*
* @return Response
*/
public function __construct()
{
$this->data['menu'] = Models\Menu::with('child')->where('level', 0)->get();
$this->data['berita'] = Models\Berita::orderBy('tanggal', 'desc')->limit(4)->get();
$this->data['pengumuman'] = Models\Pengumuman::orderBy('tanggal', 'desc')->limit(5)->get();
$this->data['agenda'] = Models\Agenda::orderBy('tgl_posting', 'desc')->limit(5)->get();
$this->data['polling'] = Models\Polling::with('jawaban')->where('status', 'Y')->limit(1)->first();
}
示例15: findModel
protected function findModel($id)
{
if (($model = Menu::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}