Example #1
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $store = Store::find($id);
     $days = Day::all();
     $brands = Brand::lists('brand_name', 'id')->all();
     $payment_types = PaymentType::lists('type_name', 'id')->all();
     return view('admin.stores.edit', compact('store', 'days', 'brands', 'payment_types'));
 }
Example #2
0
use App\Http\Controllers\RoomsController;
use App\Http\Controllers\TimeslotsController;
use App\Room;
use App\Timeslot;
Route::model('room', 'App\\Room');
Route::get('/', function () {
    return view('welcome');
});
Route::get('/home', HomeController::class . '@index');
Route::get('/week', function () {
    return View::make('control-pages.week', ['rooms' => Room::all()]);
});
Route::resource('room', RoomsController::class);
Route::resource('timeslot', TimeslotsController::class);
Route::get('/api/week', function () {
    return ['Maandag' => Timeslot::where('day_id', '1')->orderBy('begin')->get(), 'Dinsdag' => Timeslot::where('day_id', '2')->orderBy('begin')->get(), 'Woensdag' => Timeslot::where('day_id', '3')->orderBy('begin')->get(), 'Donderdag' => Timeslot::where('day_id', '4')->orderBy('begin')->get(), 'Vrijdag' => Timeslot::where('day_id', '5')->orderBy('begin')->get(), 'Zaterdag' => Timeslot::where('day_id', '6')->orderBy('begin')->get(), 'Zondag' => Timeslot::where('day_id', '7')->orderBy('begin')->get()];
});
Route::get('/api/week/{room}', function (Room $room) {
    $days_list = \App\Day::all();
    $days = [];
    foreach ($days_list as $day) {
        $days[$day->day] = [];
    }
    foreach ($room->timeslots as $timeslot) {
        $days[$timeslot->day->day][] = $timeslot;
    }
    return $days;
});
Route::get('/api/rooms', function () {
    return \App\Room::with('timeslots')->get();
});
Example #3
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $days = Day::all();
     return view('dashboard.admin.day.index', ['day' => $days]);
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param Timeslot $timeslot
  * @return \Illuminate\Http\Response
  */
 public function edit(Timeslot $timeslot)
 {
     $data = ['days' => Day::all(), 'rooms' => Room::all(), 'timeslot' => $timeslot];
     return view('timeslots.edit', $data);
 }