/** * Update the specified parkinglotuser in storage. * * @param int $id * @return Response */ public function update($id) { $parkinglotuser = ParkingLotUser::findOrFail($id); $validator = Validator::make($data = Input::all(), Parkinglotuser::$rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } $parkinglotuser->update($data); return Redirect::route('parkinglotusers.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(); }