コード例 #1
0
 public function single($url)
 {
     if (!menu301s($url)) {
         $category = $this->menuCategory->where('url', $url)->first();
         $items = $this->menuItem->where('archive', 0)->where('category', $category->id)->where('archive', 0)->where('draft', 0)->orderby('order', 'asc')->get();
         $metaTitle = 'Menu » ' . $category->name;
         return view('pages.menu-single', compact('category', 'items', 'metaTitle'));
     }
     return menu301s($url);
 }
コード例 #2
0
 public function run()
 {
     MenuItem::create(['title' => 'Check-In', 'icon' => 'list', 'view' => 'saferoll/checkins', 'section' => 'saferoll', 'sequence' => 0]);
     MenuItem::create(['title' => 'Rooms', 'icon' => 'building', 'view' => 'saferoll/rooms', 'section' => 'admin', 'sequence' => 0]);
     MenuItem::create(['title' => 'Children', 'icon' => 'child', 'view' => 'saferoll/children', 'section' => 'admin', 'sequence' => 1]);
     MenuItem::create(['title' => 'Daycare Settings', 'icon' => 'bed', 'view' => 'saferoll/settings', 'section' => 'admin', 'sequence' => 2]);
 }
コード例 #3
0
 /**
  * @param Request $request
  * @param $input
  * @return static
  */
 public function createMenuItem(Request $request, $input)
 {
     $item = $this->menuItem->create($input);
     if ($request->hasFile('image')) {
         // check if previous photo exists and delete it.
         $item->deletePhoto($item->image);
         // generate a random file name
         $filename = Str::random(10) . time();
         // assinged file input to a variable
         $image = $request['image'];
         $extension = $image->getClientOriginalExtension();
         // open image file
         $photo = Image::make($image->getRealPath());
         $photo->resize(700, null, function ($constraint) {
             $constraint->aspectRatio();
         });
         $photo->crop(700, 525);
         // final file name
         $filename = $filename . '.' . $extension;
         // save file with medium quality
         $photo->save(public_path() . '/uploads/menu_items/' . $filename, 100);
         // get original image file extension
         // store file name in database
         $item->image = $filename;
     }
     $item->save();
     return $item;
 }
 /**
  * @param $package_id
  * @param Request $request
  * @return \Illuminate\View\View
  */
 public function getModalTable($package_id, Request $request)
 {
     if ($request->ajax()) {
         $package = Package::findOrFail($package_id);
         $menuitems = MenuItem::notListed($package_id)->get();
         return view('admin.packages.modals.package_menuitems._table', compact('package', 'menuitems'));
     } else {
     }
 }
コード例 #5
0
ファイル: MenuController.php プロジェクト: khoale193/lavarel
 public function doEditDish()
 {
     $mid = Input::get('mid');
     $menuItem = MenuItem::where('mid', '=', $mid)->get();
     foreach ($menuItem->toArray() as $im) {
         $idish = Input::get('imname_' . $im['imid']);
         $price = Input::get('unit_price_' . $im['imid']);
         foreach ($idish as $key => $dish) {
             Dish::insert(['dname' => $dish, 'imid' => $im['imid'], 'unit_price' => $price[$key]]);
         }
     }
     return redirect()->route('/teabreak/menu');
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     MenuItem::destroy($id);
     return response()->json(['message' => 'success']);
 }