/** * Display a listing of the resource. * * @return Response */ public function index() { DB::connection()->enableQueryLog(); $filter = array_replace(['type' => 'all', 'day' => 'any', 'sizes' => [], 'specs' => [], 'via' => ['Hamburg', '', '', 'Berlin'], 'sort' => 'price desc'], Input::get('filter', [])); $shipments = Shipment::ofType($filter['type'])->via($filter['via'])->shipsOn($filter['day'])->onlySizes($filter['sizes'])->withoutSpecs('specs', $filter['specs'])->get(); $shipments = $this->sortShipments($shipments, $filter['sort']); return view('shipments.index')->with('shipments', $shipments)->with('filter', $filter)->with('sizes', Size::all())->with('specs', Spec::all()); }
public function run() { Size::create(['name' => 'Umschlag', 'description' => 'Ein Umschlag bis A4']); Size::create(['name' => 'Päckchen', 'description' => '...']); Size::create(['name' => 'Paket', 'description' => '...']); Size::create(['name' => 'Großgerät', 'description' => '...']); Size::create(['name' => 'Möbel', 'description' => '...']); }
public function select($shipment) { $shipment = Auth::user()->shipments()->withUnpublished()->findOrFail($shipment); $size = Size::findOrFail(Input::get('size')); $shipment->size()->associate($size); $shipment->save(); return redirect(route('shipments.edit', $shipment)); }