Ejemplo n.º 1
0
 public function index()
 {
     Title::prepend('Menu');
     $data = ['items' => Menu::orderBy('position', 'asc')->orderBy('sort', 'asc')->get(), 'title' => Title::renderr(' : ', true)];
     view()->share('menu_item_active', 'menu');
     return view('root.menu.index', $data);
 }
 /**
  * @return \Illuminate\View\View
  */
 public function index()
 {
     // Log action by user.
     Audit::log(Auth::user()->id, trans('admin/menu-builder/menu-builder.audit-log.category'), trans('admin/menu-builder/menu-builder.audit-log.msg-index'));
     // Set page title and description.
     $page_title = trans('admin/menu-builder/menu-builder.page.index.title');
     $page_description = trans('admin/menu-builder/menu-builder.page.index.description');
     // Load all menus ordered by Parent (asc), Position (asc), Label (asc) and finally ID (asc).
     $menus = Menu::orderBy('parent_id', 'ASC')->orderBy('position', 'ASC')->orderBy('label', 'ASC')->orderBy('id', 'ASC')->get();
     // Convert menu query result to JSON for JSTree
     $menusJson = $this->menusOrmToJsTreeJson($menus);
     // List label and id of all menus ordered by Label (asc).
     $parents = Menu::where('separator', '0')->orderBy('label', 'ASC')->orderBy('id', 'ASC')->get()->lists('label', 'id');
     // Convert to array.
     $parents = $parents->toArray();
     // List name and id of all routes ordered by Name (asc).
     $routes = Route::whereNotNull('name')->orderBy('name', 'ASC')->get()->lists('name', 'id');
     // Convert to array.
     $routes = $routes->toArray();
     // Add a blank option at the top.
     $routes = array('blank' => '') + $routes;
     // List display name and id of all permissions ordered by Name (asc).
     $permissions = Permission::orderBy('name', 'ASC')->get()->lists('display_name', 'id');
     // Convert to array.
     $permissions = $permissions->toArray();
     // Add a blank option at the top.
     $permissions = array('blank' => '') + $permissions;
     // Return view
     return view('admin.menus.index', compact('menus', 'menusJson', 'parents', 'routes', 'permissions', 'page_title', 'page_description'));
 }
Ejemplo n.º 3
0
 public function index()
 {
     $data = ['items' => Menu::orderBy('position', 'asc')->orderBy('sort', 'asc')->get(), 'title' => 'Menu'];
     $this->title->prepend($data['title']);
     View::share('menu_item_active', 'menu');
     return view('root.menu.index', $data);
 }
Ejemplo n.º 4
0
 /**
  * 将数据绑定到视图。
  *
  * @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);
 }
Ejemplo n.º 5
0
 public function getIndex()
 {
     $weight_list = [];
     $menuitem_count = Menu::all()->count();
     for ($i = 1; $i <= $menuitem_count; $i++) {
         $weight_list[$i] = $i;
     }
     return view('admin.menu.index', ['menuitems' => Menu::orderBy('weight')->get(), 'weight_list' => $weight_list]);
 }
Ejemplo n.º 6
0
 public function menuList()
 {
     $menu = Menu::orderBy('id', 'asc')->get();
     return view('admin.menu.index', ['menu' => $menu]);
 }
Ejemplo n.º 7
0
<?php

// Home
Route::get('/', ['uses' => 'HomeController@index', 'as' => 'home']);
View::composer('partials.menu', function ($view) {
    $view->with('menuitems', \App\Models\Menu::orderBy('weight')->get());
});
View::composer('partials.categories', function ($view) {
    $view->with('categories', \App\Models\Category::tree());
});
View::composer('banners.index', function ($view) {
    $view->with('banners', \App\Models\Banner::all());
});
Route::controllers(['auth' => 'Auth\\AuthController', 'password' => 'Auth\\PasswordController', 'products' => 'ProductController', 'user' => 'UserController', 'cart' => 'CartController']);
Route::group(['middleware' => ['auth']], function () {
    Route::controllers(['order' => 'OrderController', 'user' => 'UserController']);
});
/* < Admin > */
Route::get('admin', function () {
    return Redirect::to('admin/products');
});
Route::get('/ipn', 'Robokassa\\RobokassaController@getResult');
Route::post('/create_payment', 'Robokassa\\PaymentController@createPayment');
Route::group(['middleware' => ['auth', 'admin']], function () {
    Route::controllers(['admin/orders' => 'Admin\\OrderController', 'admin/order_products' => 'Admin\\OrderProductController', 'admin/categories' => 'Admin\\CategoryController', 'admin/products' => 'Admin\\ProductController', 'admin/productimage' => 'Admin\\ProductImageController', 'admin/users' => 'Admin\\UserController', 'admin/menu' => 'Admin\\MenuController', 'admin/currency' => 'Admin\\CurrencyController', 'admin/slider' => 'Admin\\SliderController', 'admin/blocks_content' => 'Admin\\BlocksContentController', 'admin/blocks_content_products' => 'Admin\\BlocksContentProductsController', 'admin/stat' => 'Admin\\StatisticController', 'admin/banners' => 'Admin\\BannerController']);
});
/* </ Admin > */
Route::any("/{slug}", array("as" => "content", "uses" => "MenuController@content"));
Ejemplo n.º 8
0
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     View::composer('partials.menu', function ($view) {
         $view->with('menuitems', \App\Models\Menu::orderBy('weight')->get());
     });
 }
Ejemplo n.º 9
0
 public function apiDataMenu()
 {
     $data = Menu::orderBy('id', 'desc')->get();
     return response()->json($data);
 }
Ejemplo n.º 10
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $waste = Wastes::findOrFail($id);
     $currentPeriodId = Helper::defaultPeriodId();
     $periods = StockPeriods::all();
     $period_list = array();
     foreach ($periods as $period) {
         $period_list[$period->id] = 'Stock #' . $period->number . ' (' . $period->date_from . ' - ' . ($period->id == $currentPeriodId ? 'NOW' : $period->date_to) . ')';
     }
     if (Input::has('stock_period')) {
         $currentPeriodId = Input::get('stock_period');
     }
     $select_recipes = Recipes::orderBy('title', 'ASC')->lists('title', 'id');
     $items = ItemUnits::orderBy('default', 'DESC')->get();
     $items_units = [];
     foreach ($items as $item) {
         $items_units['list'][$item->item()->first()->id][] = ['id' => $item->id, 'title' => $item->unit()->first()->title];
         $items_units['php_list'][$item->item()->first()->id][$item->id] = $item->unit()->first()->title;
         $items_units['factors'][$item->id] = $item->factor;
     }
     $select_items = Items::orderBy('title', 'ASC')->lists('title', 'id');
     $select_menus = Menu::orderBy('title', 'ASC')->lists('title', 'id');
     $select_reasons = WasteReasons::orderBy('reason', 'ASC')->lists('reason', 'id');
     return view('Wastes.edit')->with(array('title' => $this->title, 'recipes' => $select_recipes, 'items' => $select_items, 'items_units' => $items_units, 'menus' => $select_menus, 'period' => $currentPeriodId, 'stocks_list' => $period_list, 'reasons' => $select_reasons, 'waste' => $waste));
 }
Ejemplo n.º 11
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     return view('Menus.index')->with(array('title' => $this->title, 'items' => Menu::orderBy('checked', 'ASC')->orderBy('title', 'ASC')->get()));
 }