select(['units.id', 'unit_translations.title']) ->where('unit_translations.locale', app()->getLocale())) ->addColumn('options', function ($model) { return View::make('partials.options', compact('model'))->render(); }) ->make(true); } public function index() { return view('unit.index'); } /** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { return view('unit.create', ['unit' => new Unit]); } /** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(UnitRequest $request) { $unit = Unit::create($request->all()); return redirect()->route('admin.unit.edit', $unit); } /** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show(Unit $unit) { return view('public.room', compact('unit')); } /** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit(Unit $unit) { $calendar = Calendar::addEvents($unit->reservations)->setOptions(['firstDay' => 1, 'height' => 'auto', 'header' => ['left' => 'prev,next', 'center' => 'title', 'right' => '']]); return view('unit.edit', compact('unit', 'calendar')); } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(UnitRequest $request, Unit $unit) { $unit->update($request->all()); return redirect()->route('admin.unit.index'); } /** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy(Unit $unit) { $unit->delete(); } }