Exemplo n.º 1
0
 public function getLongLat($csvData, $person_type)
 {
     $personArr = [];
     if ($person_type == 'seller') {
         $sellerArr = [];
         SellerController::createSeller($personArr, $sellerArr);
     } else {
         $customerArr = [];
         CustomerController::createSeller($personArr, $customerArr);
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     // Validate
     $validator = Validator::make($request->all(), ['first_name' => 'required|between:3,50', 'last_name' => 'required|between:3,50', 'citizen_id' => 'required|unique:customers|digits:13', 'date_of_birth' => 'required', 'telephone_number' => 'digits:9', 'phone_number' => 'required|digits:10', 'email' => 'required|email|between:4,50', 'address_line1' => 'required|max:100', 'address_line2' => 'max:100', 'city' => 'required|max:45', 'province' => 'required|max:45', 'post_code' => 'required|digits:5']);
     if ($validator->fails()) {
         return back()->withErrors($validator)->withInput();
     }
     //add new customer
     $customerController = new CustomerController();
     $customerId = $customerController->store($request, true);
     //update room status
     $roomController = new RoomController();
     $roomController->updateRoomStatus(true, $request->get('room_id'));
     $rent = new Rent();
     $rent->check_in = date('Y-m-d H:i:s');
     $rent->customer_id = $customerId;
     $rent->room_id = $request->get('room_id');
     //        $rent->created_at->timezone('Asia/Bangkok');
     $rent->save();
     return redirect('rental');
 }