コード例 #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('additions')->delete();
     for ($i = 0; $i < count($this->items); $i++) {
         $row = array_combine(['name', 'description', 'weight', 'price', 'image'], $this->items[$i]);
         Addition::create($row);
     }
 }
コード例 #2
0
ファイル: LunchsController.php プロジェクト: jambik/halal-eda
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $item = Lunch::findOrFail($id);
     $meal1 = Meal1::lists('name', 'id')->all();
     $meal2 = Meal2::lists('name', 'id')->all();
     $garnishs = Garnish::lists('name', 'id')->all();
     $salads = Salad::lists('name', 'id')->all();
     $drinks = Drink::lists('name', 'id')->all();
     $additions = Addition::allWithSelection($item->addition_list);
     return view('admin.lunchs.edit', compact('item', 'meal1', 'meal2', 'garnishs', 'salads', 'drinks', 'additions'));
 }
コード例 #3
0
ファイル: SubsController.php プロジェクト: jambik/halal-eda
 /**
  * Show the form for edit subscription
  *
  * @return Response
  */
 public function showSubs($id)
 {
     $lunchs = Lunch::with('meal1', 'meal2', 'garnish', 'salad', 'drink', 'additions')->where('user_id', 0)->get();
     $meal1 = Meal1::all();
     $meal2 = Meal2::all();
     $garnishs = Garnish::all();
     $salads = Salad::all();
     $drinks = Drink::all();
     $additions = Addition::all();
     $user = User::findOrFail($id);
     $subs = Sub::with('lunch.meal1', 'lunch.meal2', 'lunch.garnish', 'lunch.salad', 'lunch.drink')->byUser($id)->get();
     $daysOfWeek = trans('vars.day_of_week');
     return view('admin.subs.save', compact('user', 'subs', 'lunchs', 'meal1', 'meal2', 'garnishs', 'salads', 'drinks', 'additions', 'daysOfWeek'));
 }
コード例 #4
0
ファイル: IndexController.php プロジェクト: jambik/halal-eda
 /**
  * Show the application welcome screen to the user.
  *
  * @return Response
  */
 public function index()
 {
     $lunchs = Lunch::whereUserId(NULL)->with('meal1', 'meal2', 'garnish', 'salad', 'drink', 'additions')->get();
     $meal1 = Meal1::all();
     $meal2 = Meal2::all();
     $garnishs = Garnish::all();
     $salads = Salad::all();
     $drinks = Drink::all();
     $additions = Addition::all();
     $daysOfWeek = trans('vars.day_of_week');
     $subs = Auth::user() ? Sub::with('lunch.meal1', 'lunch.meal2', 'lunch.garnish', 'lunch.salad', 'lunch.drink', 'lunch.additions')->byUser(Auth::user()->id)->get() : false;
     $user = Auth::user() ? User::with('contact')->find(Auth::user()->id) : false;
     $lunchCount = 3;
     $menuCount = 5;
     return view('app', compact('user', 'subs', 'lunchs', 'meal1', 'meal2', 'garnishs', 'salads', 'drinks', 'additions', 'daysOfWeek', 'lunchCount', 'menuCount'));
 }
コード例 #5
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Addition::destroy($id);
     Flash::success("Запись - {$id} удалена");
     return redirect(route('admin.additions.index'));
 }