本文整理汇总了PHP中app\Menu::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Menu::where方法的具体用法?PHP Menu::where怎么用?PHP Menu::where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Menu
的用法示例。
在下文中一共展示了Menu::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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]);
}
示例2: 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;
}
}
示例3: __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);
}
}
示例4: __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]);
}
示例5: deleteMenu
public function deleteMenu()
{
$id = (int) Input::get('id');
$menu = Menu::where('parent', $id);
if (!$menu->exists()) {
Menu::destroy($id);
}
return 1;
}
示例6: headerPageName
public function headerPageName($route_name)
{
if (!is_null($route_name)) {
// DB::enableQueryLog();
// dd(DB::getQueryLog());
$menuDescription = Menu::where('rota', $route_name)->get()->first();
$headerText = "<h1>" . $menuDescription->nome . "<small>" . $menuDescription->descricao . "</small></h1>";
return $headerText;
}
}
示例7: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
$menu = Menu::findOrFail($id);
$data = ['id' => $id];
foreach (array_keys($this->fields) as $field) {
$data[$field] = old($field, $menu->{$field});
}
$parent_list = Menu::where('parent_id', '=', 0)->where('id', '!=', $id)->orderBy('order', 'asc')->select('id', 'title')->get();
return view('admin.menu.edit', $data)->with('parent_list', $parent_list);
}
示例8: boot
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
$tags = Tag::lists('tag')->all();
view()->composer('index', view()->share('tags', $tags));
//后台菜单
$menus = Menu::where('parent_id', '=', 0)->orderBy('order', 'asc')->get();
foreach ($menus as &$value) {
$value['child_list'] = Menu::where('parent_id', '=', $value['id'])->where('status', '=', 1)->orderBy('order', 'asc')->get();
}
view()->composer('admin', view()->share('menus', $menus));
}
示例9: handle
/**
* Handle the event.
*
* @param CreateMenuEvent $event
* @return void
*/
public function handle(CreateMenuEvent $event)
{
// return array([
// 'icon' => 'fa-user',
// 'title' => 'Settings'
// ],
// [
// 'icon' => 'fa-trash-o',
// 'title' => 'Settings',
// 'children' => array(
// 'General' => '[url]',
// 'Blog' => '[url]'
// )],
// [
// 'icon' => 'fa-trash-o',
// 'title' => 'Settings',
// 'children' => array(
// 'Haha' => '[url]',
// 'Blog' => '[url]'
// )]
// );
$user = $event->user;
$menu = [];
$user = User::find($user->id);
$main = Menu::where('is_main', '=', 1)->get()->toArray();
foreach ($main as $item) {
$role = [];
$role = Role::find($item['role']);
$child = Menu::where('parent', '=', $item['id'])->get()->toArray();
$me = [];
if ($user->hasRole($role->name)) {
$me['icon'] = $item['icon'];
$me['title'] = $item['name'];
if (isset($child) && !empty($child)) {
foreach ($child as $c) {
$permission = Permission::find($c['permission']);
if ($user->can($permission->name)) {
$me['children'][$c['name']] = $c['route'];
} else {
continue;
}
}
}
} else {
continue;
}
$menu[] = $me;
}
return $menu;
}
示例10: compose
/**
* Bind data to the view.
*
* @param View $view
* @return void
*/
public function compose(View $view)
{
//当前路由
$currentRouteName = Route::currentRouteName();
$currentRouteName = preg_replace('/(admin)(\\.[a-z]*)(\\.[a-z]*)/', '$1$2', $currentRouteName);
if (!empty($currentRouteName)) {
$menu = Menu::where('route_name', '=', $currentRouteName)->first();
if (!empty($menu)) {
$fmenu = Menu::where('id', '=', $menu->fid)->first();
$view->with('menu', $menu)->with('fmenu', $fmenu);
}
} else {
$dash = 'Dashboard';
$view->with('dash', $dash);
}
}
示例11: menuAction
public function menuAction()
{
$menu_id = (int) Input::get('id', 0);
if (!$menu_id) {
$codemenu = Menu::where('slug', '=', 'civil')->first();
$menu_id = $codemenu->id;
}
$allmenus = Menu::orderBy('level', 'ASC')->orderBy('title', 'ASC')->get()->toArray();
$menus = $this->clubarr($allmenus);
$topicarr = Menu::find($menu_id)->topics()->orderBy('level', 'ASC')->orderBy('title', 'ASC')->get()->toArray();
$topics = $this->clubarr($topicarr);
$articles = Menu::find($menu_id)->articles()->join('article_contents', 'article_contents.article_id', '=', 'articles.id')->get(['articles.*', 'article_contents.title'])->toArray();
$viewarr = array('articles' => $articles, 'menus' => $menus, 'menuid' => $menu_id, 'topics' => $topics, 'topicid' => 0);
\View::share('pagetitle', Menu::find($menu_id)->first()->title);
return view('civil.menulist')->with($viewarr);
}
示例12: getMenu
public static function getMenu(){
$arr_menu = Menu::where('active','=',1)->orderBy('order_no')->get()->toArray();
$menus= array();
foreach ($arr_menu as $key => $menu) {
if($menu['parent_id']==0){
$menus[$menu['id']] = $menu;
$menus[$menu['id']]['children'] = array();
}
}
foreach ($arr_menu as $key => $menu) {
if(isset($menus[$menu['parent_id']])){
$menus[$menu['parent_id']]['children'][] = $menu;
}
}
return $menus;
}
示例13: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$menu_id = \App\Menu::where('menu_type', '=', 'Appetizer')->pluck('id');
DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'recipe_name' => 'Vegetable Samosa', 'menu_id' => $menu_id, 'user_id' => 1, 'image_url' => 'https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcT_e7I4C_lUkMuhsadXSGP4eycr1lw6XVAyoiiOcYkq33C7W2f9']);
$menu_id = \App\Menu::where('menu_type', '=', 'Drinks')->pluck('id');
DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'recipe_name' => 'Thandai', 'menu_id' => $menu_id, 'user_id' => 1, 'image_url' => 'http://www.burrp.com/know/wp-content/uploads/2014/03/Almond-Thandai-Cocktail-300x300.jpg']);
$menu_id = \App\Menu::where('menu_type', '=', 'Paneer Speical')->pluck('id');
DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'recipe_name' => 'Paneer Masala', 'menu_id' => $menu_id, 'user_id' => 1, 'image_url' => 'https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcStXXrG4yj8m7UwaAa4tw-cJk4EIf84LdvIHkKouZ1wMEm8pgYD']);
$menu_id = \App\Menu::where('menu_type', '=', 'Daal Speical')->pluck('id');
DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'recipe_name' => 'Daal Makhni', 'menu_id' => $menu_id, 'user_id' => 1, 'image_url' => 'http://images.tastespotting.com/thumbnails/707997.jpg']);
$menu_id = \App\Menu::where('menu_type', '=', 'Desserts')->pluck('id');
DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'recipe_name' => 'Faluda Malai Kulfi', 'menu_id' => $menu_id, 'user_id' => 1, 'image_url' => 'https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcSsSJ9C47iOWslT2euXH8jToC9g9VeP1fRJ-gWPDcDS9v9Ly4j7']);
$menu_id = \App\Menu::where('menu_type', '=', 'Raita')->pluck('id');
DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'recipe_name' => 'Boondi Raita', 'menu_id' => $menu_id, 'user_id' => 1, 'image_url' => 'https://photo.foodgawker.com/wp-content/uploads/2013/04/1310004.jpeg']);
$menu_id = \App\Menu::where('menu_type', '=', 'Naan')->pluck('id');
DB::table('recipes')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'recipe_name' => 'Garlic Naan', 'menu_id' => $menu_id, 'user_id' => 1, 'image_url' => 'https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcQMs89yBUWBiIfjO78oZEXE8hvT3_GOd3wgs_YVy3kxcjqKM9Ml']);
}
示例14: addTopic
public function addTopic()
{
Input::merge(array_map('trim', Input::all()));
$pageslug = Input::get('pageslug');
$coremenu = Menu::where('slug', $pageslug)->first();
if ($coremenu->exists()) {
$level = (int) Input::get('level');
$parent = Input::get('id');
$name = Input::get('val');
$mn = new Topic();
$mn->menu_id = $coremenu->id;
$mn->title = ucwords($name);
$mn->parent = $parent;
$mn->level = $level;
$mn->save();
}
return 1;
}
示例15: __construct
/**
* Create a new profile composer.
*
* @param Resquest $request
* @return void
*/
public function __construct(Request $request)
{
$this->menus = Menu::where('ativo', 1)->get();
// Dependencies automatically resolved by service container...
$usuario = $request->user();
$grupos = [];
$grupos_usuario = UsuarioGrupo::where('usuario', $usuario->id)->get();
if ($grupos_usuario) {
foreach ($grupos_usuario as $g) {
$grupos[] = $g->grupo;
}
}
$grupos_permissao = GrupoPermissao::where('grupo', $grupos)->get();
if ($grupos_permissao) {
foreach ($grupos_permissao as $gp) {
$this->permissao[] = $gp->menu;
}
}
}