/** * Store a newly created parkinglotuser in storage. * * @return Response */ public function store() { $validator = Validator::make($data = Input::all(), ParkingLotUser::$rules); if ($validator->fails()) { dd($validator->messages()); return Redirect::back()->withErrors($validator)->withInput(); } $userId = Auth::user()->id; $parking_lot_user = new ParkingLotUser(); $parking_lot_user->parking_lot_id = Input::get('parking-lot-id'); $parking_lot_user->user_id = $userId; $parking_lot_user->save(); return Redirect::route('orders.index'); }
public function run() { $preferred_parking_lot = ParkingLot::all()->random(); $user = User::firstOrFail(); $preferred_parking_lot_user = new ParkingLotUser(); $preferred_parking_lot_user->parking_lot_id = $preferred_parking_lot->id; $preferred_parking_lot_user->user_id = $user->id; $preferred_parking_lot_user->save(); $preferred_parking_lot = ParkingLot::all()->random(); $preferred_parking_lot_user = new ParkingLotUser(); $preferred_parking_lot_user->parking_lot_id = $preferred_parking_lot->id; $preferred_parking_lot_user->user_id = $user->id; $preferred_parking_lot_user->save(); $preferred_parking_lot = ParkingLot::all()->random(); $preferred_parking_lot_user = new ParkingLotUser(); $preferred_parking_lot_user->parking_lot_id = $preferred_parking_lot->id; $preferred_parking_lot_user->user_id = $user->id; $preferred_parking_lot_user->save(); $preferred_parking_lot = ParkingLot::all()->random(); $preferred_parking_lot_user = new ParkingLotUser(); $preferred_parking_lot_user->parking_lot_id = $preferred_parking_lot->id; $preferred_parking_lot_user->user_id = $user->id; $preferred_parking_lot_user->save(); }