/**
  * 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;
 }
Exemple #2
0
 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();
 }
 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];
 }
 /**
  * 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!');
 }
 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' => '*****@*****.**', '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);
     }
 }
 /**
  * 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);
     }
 }
Exemple #7
0
 /**
  * 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();
     }
 }
Exemple #8
0
 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]);
 }
 /**
  * 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'));
 }
 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;
     }
 }
Exemple #11
0
 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);
 }
 /**
  * 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]);
 }
Exemple #13
0
 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]);
 }
Exemple #14
0
 /**
  * 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');
 }
Exemple #15
0
 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";
 }
Exemple #16
0
 public function deleteMenu()
 {
     $id = (int) Input::get('id');
     $menu = Menu::where('parent', $id);
     if (!$menu->exists()) {
         Menu::destroy($id);
     }
     return 1;
 }
Exemple #17
0
 public function editDish($mid)
 {
     // Get menu infor
     $menu = Menu::find($mid)->get();
     // Get menu-sub infor
     $menuItem = MenuItem::where('mid', '=', $mid)->get();
     $viewArr = ['menu' => $menu->toArray()[0], 'imenu' => $menuItem->toArray()];
     return view("teabreak/menu/editDish", $viewArr);
 }
 public function get_menu()
 {
     $rekap = array();
     $data = \App\Menu::all();
     foreach ($data as $key) {
         $rekap[] = array('id' => $key->id, 'parentid' => $key->id_induk, 'text' => $key->nama, 'value' => $key->id);
     }
     echo json_encode($rekap);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(CreateContentRequest $request)
 {
     $this->dispatch(new CreateContentCommand(Auth::user(), $request));
     $menu = Menu::find($request->menu_id);
     if ($menu) {
         return redirect('/admin/menu/' . $menu->id);
     }
     return redirect('/admin/content');
 }
 public function search(DanhmucchuyendeSearchIndexRequest $query)
 {
     $menus = Menu::all();
     $querys = $query->input('query');
     $danhmucchuyendes = Danhmucchuyende::where('name', 'LIKE', '%' . $querys . '%')->orderBy('name')->paginate(10);
     if ($danhmucchuyendes == NULL) {
         $danhmucchuyendes = 'Không Tìm Thấy';
     }
     return view('danhmucchuyende.index')->with(array('danhmucchuyendes' => $danhmucchuyendes, 'menus' => $this->menus));
 }
 public function search(CongviecSearchIndexRequest $query)
 {
     $menus = Menu::all();
     $querys = $query->input('query');
     $congviecs = \DB::table('congviecs')->join('tinhtrangcongviecs', 'tinhtrangcongviecs.id', '=', 'congviecs.tinhtrangcongviec_id')->join('danhmucnguonphatsinhs', 'danhmucnguonphatsinhs.id', '=', 'congviecs.nguonphatsinh_id')->select('congviecs.id', 'nguonphatsinh_id', 'socongvanden', 'ngayluu', 'noidungcongviec', 'canhanthuchien', 'ngaybatdau', 'thoigianthuchien', 'ngayketthuc', 'tinhtrangcongviec_id', 'mucdohoanthanh', 'chidaodanhgia', 'file_id', 'tinhtrangcongviecs.name as tinhtrangcongviec', 'danhmucnguonphatsinhs.name as nguonphatsinh')->where('socongvanden', 'LIKE', '%' . $querys . '%')->orWhere('noidungcongviec', 'LIKE', '%' . $querys . '%')->orWhere('canhanthuchien', 'LIKE', '%' . $querys . '%')->orWhere('mucdohoanthanh', 'LIKE', '%' . $querys . '%')->orWhere('lydokhonghoanthanh', 'LIKE', '%' . $querys . '%')->orWhere('chidaodanhgia', 'LIKE', '%' . $querys . '%')->paginate(10);
     if ($congviecs == NULL) {
         $congviecs = 'Không Tìm Thấy';
     }
     return view('congviec.index')->with(array('congviecs' => $congviecs, 'menus' => $this->menus));
 }
 public function search(UserSearchIndexRequest $query)
 {
     $menus = Menu::all();
     $querys = $query->input('query');
     $users = User::where('username', 'LIKE', '%' . $querys . '%')->orWhere('email', 'LIKE', '%' . $querys . '%')->orWhere('name', 'LIKE', '%' . $querys . '%')->paginate(10);
     if ($users == NULL) {
         $users = 'Không Tìm Thấy';
     }
     return view('user.index')->with(array('users' => $users, 'menus' => $menus));
 }
Exemple #23
0
 public function run()
 {
     DB::table('menus')->delete();
     Menu::create(['mn_name' => 'Sidebar', 'mn_description' => 'Segment on the left side of the admin screen (e.g. all the app_modules).', 'mn_enabled' => 1, 'created_by' => 1]);
     Menu::create(['mn_name' => 'Top', 'mn_description' => 'Segment at the top of the screen, on the side of the profile menu (e.g. notifications, messages, flags).', 'mn_enabled' => 1, 'created_by' => 1]);
     Menu::create(['mn_name' => 'User', 'mn_description' => 'Segment at the top right, displayed after pressing the username (e.g. user settings, admin).', 'mn_enabled' => 1, 'created_by' => 1]);
     Menu::create(['mn_name' => 'Settings Panel', 'mn_description' => 'Administration panel available for SAdmin and Admin users.', 'mn_enabled' => 1, 'created_by' => 1]);
     Menu::create(['mn_name' => 'User Panel', 'mn_description' => 'User profile panel.', 'mn_enabled' => 1, 'created_by' => 1]);
     Menu::create(['mn_name' => 'Dashboard', 'mn_description' => 'Dashboard panel at application home', 'mn_enabled' => 1, 'created_by' => 1]);
 }
 public function search(canboSearchIndexRequest $query)
 {
     $menus = Menu::all();
     $querys = $query->input('query');
     $canbos = Canbo::where('name', 'LIKE', '%' . $querys . '%')->orWhere('fullname', 'LIKE', '%' . $querys . '%')->orderBy('name')->paginate(10);
     if ($canbos == NULL) {
         $canbos = 'Không Tìm Thấy';
     }
     return view('canbo.index')->with(array('canbos' => $canbos, 'menus' => $this->menus));
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     if (Auth::check() && $this->rolechucnangs && $this->rolechucnangs->Danhsach == 1) {
         $menus = Menu::all();
         $roles = Role::all();
         return view('role.index')->with(array('menus' => $this->menus, 'roles' => $roles, 'rolechucnangs' => $this->rolechucnangs));
     } else {
         return \Redirect::to('/')->with('message-error', 'Không có quyền truy cập');
     }
 }
 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;
     }
 }
 public function scrape5CMenu()
 {
     $client = new Client();
     $crawler = $client->request('GET', 'https://aspc.pomona.edu/menu/');
     $status_code = $client->getResponse()->getStatus();
     if ($status_code == 200) {
         echo '200 OK<br>';
     }
     $date = substr(Carbon::today(), 0, 10);
     $crawler->filter('table')->last()->filter('tr')->each(function ($row) use($date) {
         $count = 0;
         $row->filter('td ul')->each(function ($node, $count) use($date) {
             $diningHall = substr($node->parents()->parents()->attr('id'), 0, -5);
             $node->filter('li')->each(function ($node1) use($count, $diningHall, $date) {
                 if ($count == 0) {
                     $meal = 'breakfast';
                 } elseif ($count == 1) {
                     $meal = 'lunch';
                 } else {
                     $meal = 'dinner';
                 }
                 $food = $node1->text();
                 echo "For " . $meal . " we have " . $food . " at " . $diningHall;
                 echo "<br>";
                 $count++;
                 $store_id = DB::table('stores')->where('sh_name', $diningHall)->value('store_id');
                 $id = DB::table('email_articles')->where('post_date', $date)->value('article_id');
                 if (Menu::where('foodName', $food)->where('meal', '=', $meal)->where('article_id', $id)->where('store_id', $store_id)->exists()) {
                     echo $food . " already exists for " . $meal . " on" . $date;
                 } else {
                     $entry = new Menu();
                     $entry->article_id = $id;
                     $entry->store_id = $store_id;
                     $entry->foodName = $food;
                     $entry->meal = $meal;
                     $entry->save();
                     echo $food . " saved for " . $diningHall . " id " . $store_id;
                 }
             });
         });
     });
 }
 /**
  * Updates the current record in the database
  *
  * @param $id
  * @param MenuRequest $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function update($id, MenuRequest $request)
 {
     $inputs = $request->all();
     if ($request->get('is_main_course') === null) {
         $inputs['is_main_course'] = 0;
     }
     $menu = Menu::findOrFail($id);
     $menu->update($inputs);
     flash()->message('Successfully updated: ' . $menu->name, 'success');
     return redirect()->route('admin.menus.edit', [$menu->id]);
 }
Exemple #29
0
 /**
  * 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));
 }
 /**
  * Show the package edit form.
  *
  * @param $id
  * @return \Illuminate\View\View
  */
 public function edit($id)
 {
     $package = Package::findOrFail($id);
     $package_courses = $package->courses()->get();
     $package_rules = $package->rules()->get();
     $menus = Menu::orderBy('name')->where('is_main_course', 0)->lists('name', 'id');
     if (!$menus->count()) {
         $menus->put(0, 'No Menus found.');
     }
     return view('admin.packages.edit', compact('package', 'package_courses', 'package_rules', 'menus'));
 }