/** * Store a newly created allotmentinquiry in storage. * * @return Response */ public function store() { $validator = Validator::make($data = Input::all(), AllotmentInquiry::$rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } if (AllotmentInquiry::create($data)) { $hotel_users = DB::table('users')->leftJoin('hotel_user', 'users.id', '=', 'hotel_user.user_id')->where('hotel_user.hotel_id', $data->hotel_id)->get(); Mail::send('emails/rate-inquiry', function ($message) use($hotel_users, $data) { $message->subject('New Inquiry')->from('*****@*****.**', 'SriLankaHotels.Travel')->bcc('*****@*****.**', 'SriLankaHotels.Travel'); if (!empty($hotel_users)) { foreach ($hotel_users as $hotel_user) { $message->to($hotel_user->email, $hotel_user->first_name); } } }); } return Redirect::route('inquiries.allotment-inquiries.index'); }
public function requestAllotment() { $st_date = Session::get('st_date'); $ed_date = Session::get('ed_date'); if (Input::has('room_refer_id')) { $room_identity = Input::get('room_refer_id'); $room_identity_array = explode("_", $room_identity); $hotel_id = $room_identity_array[0]; $room_type = $room_identity_array[1]; $room_count = Session::get('room_count'); } if (Auth::check()) { $user_id = Auth::user()->id; } if (Session::has('market')) { $market = Session::get('market'); } //dd($room_count); $request_allotment = array('hotel_id' => $hotel_id, 'user_id' => $user_id, 'from' => $st_date, 'to' => $ed_date, 'room_type_id' => $room_type, 'room_count' => $room_count, 'market_id' => $market); $request_allotment_id = AllotmentInquiry::create($request_allotment); return Response::json(true); }