本文整理汇总了PHP中Booking::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Booking::create方法的具体用法?PHP Booking::create怎么用?PHP Booking::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Booking
的用法示例。
在下文中一共展示了Booking::create方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 10) as $index) {
Booking::create([]);
}
}
示例2: store
public function store(Request $request)
{
$validator = Validator::make($request->all(), ['arrive_date' => 'required|date', 'leave_date' => 'required|date', 'personal_ids' => 'required|string', 'room_id' => 'required|numeric']);
if ($validator->fails()) {
return $validator->errors()->all();
}
$newBooking = Booking::create($request->all());
return $newBooking;
}
示例3: store
/**
* Store a newly created resource in storage.
* POST /bookings
*
* @return Response
*/
public function store()
{
$validator = Validator::make(Input::all(), Booking::$rules, Booking::$messages);
if (Input::get('year') <= 1974) {
return Redirect::route('too-old');
}
if ($validator->fails()) {
return Redirect::route('bookings', array(Input::get('id'), Input::get('tour_date')))->withErrors($validator)->withInput(Input::except('captcha'));
}
//Store into database
$booking = Booking::create(Input::all());
//redirect to final confirmation page
return Redirect::route('bookings.confirm', array($booking->_id));
//redirect to NABTransact
//Add in additional NAB Token to database result $booking->id
//Email management with new booking details
//Return user to Thank You page
}
示例4: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Eloquent::unguard();
// $this->call('UserTableSeeder');
DB::table('bookings')->delete();
DB::table('registrations')->delete();
// Church bookings
Booking::create(array('first' => 'Spencer', 'last' => 'Kaur', 'tickets' => 1, 'source' => 'Church', 'numbers' => '1'));
Booking::create(array('first' => 'Molly', 'last' => 'Sharpe', 'tickets' => 2, 'source' => 'Church', 'numbers' => '2,3'));
Booking::create(array('first' => 'Zara', 'last' => 'Sharp', 'tickets' => 4, 'source' => 'Church', 'numbers' => '32,34,36,38'));
Booking::create(array('first' => 'Archie', 'last' => 'Field', 'tickets' => 8, 'source' => 'Church', 'numbers' => '32,33,34,35,36,37,38,39'));
Booking::create(array('first' => 'Charles', 'last' => 'Dennis', 'tickets' => 12, 'source' => 'Church', 'numbers' => '132,133,134,135,136,137,138,139,140,141,142'));
Booking::create(array('first' => 'Jack', 'last' => 'Ryan', 'tickets' => 1, 'source' => 'Church', 'numbers' => '501'));
Booking::create(array('first' => 'Charlotte', 'last' => 'Crawford', 'tickets' => 2, 'source' => 'Church', 'numbers' => '503,504'));
Booking::create(array('first' => 'Rebecca', 'last' => 'Atkinson', 'tickets' => 2, 'source' => 'Church', 'numbers' => '505,506'));
Booking::create(array('first' => 'Lara', 'last' => 'Douglas', 'tickets' => 2, 'source' => 'Church', 'numbers' => '602,605'));
Booking::create(array('first' => 'Harriet', 'last' => 'Tucker', 'tickets' => 1, 'source' => 'Church'));
Booking::create(array('first' => 'Lilly', 'last' => 'Charlton', 'tickets' => 1, 'source' => 'Church'));
Booking::create(array('first' => 'Logan', 'last' => 'Clements', 'tickets' => 2, 'source' => 'Church'));
$booking = Booking::create(array('first' => 'Evie', 'last' => 'Pritchard', 'tickets' => 1, 'source' => 'Church'));
$booking->registrations()->save(new Registration(array('tickets' => 2)));
$booking = Booking::create(array('first' => 'Lara', 'last' => 'Armstrong', 'tickets' => 2, 'source' => 'Church'));
$booking->registrations()->save(new Registration(array('tickets' => 2)));
$booking = Booking::create(array('first' => 'Charlie', 'last' => 'Slater', 'tickets' => 6, 'source' => 'Church'));
$booking->registrations()->save(new Registration(array('tickets' => 2)));
$booking = Booking::create(array('first' => 'Rachel', 'last' => 'Whittaker', 'tickets' => 1, 'source' => 'Church'));
$booking->registrations()->save(new Registration(array('tickets' => 1)));
// EventBrite bookings
Booking::create(array('first' => 'Lauren', 'last' => 'Conway', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Emily', 'last' => 'Henderson', 'tickets' => 2, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Sienna', 'last' => 'Yates', 'tickets' => 3, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Harrison', 'last' => 'Carroll', 'tickets' => 4, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Taylor', 'last' => 'Palmer', 'tickets' => 8, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Maya', 'last' => 'Marsh', 'tickets' => 10, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Riley', 'last' => 'Farmer', 'tickets' => 7, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Amelia', 'last' => 'Ashton', 'tickets' => 2, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Jonathan', 'last' => 'Riley', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Anthony', 'last' => 'Moss', 'tickets' => 2, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Ellie', 'last' => 'Henry', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Sofia', 'last' => 'Phillips', 'tickets' => 2, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Owen', 'last' => 'Bartlett', 'tickets' => 2, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Alicia', 'last' => 'Jordan', 'tickets' => 4, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Peter', 'last' => 'Hancock', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Aidan', 'last' => 'Walker', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Jennifer', 'last' => 'Sinclair', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Georgina', 'last' => 'Henry', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Jonathan', 'last' => 'Barber', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Francesca', 'last' => 'Rice', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Scott', 'last' => 'Rowe', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Nathan', 'last' => 'Gould', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Harley', 'last' => 'May', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Brandon', 'last' => 'Riley', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Brandon', 'last' => 'Richardson', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Adam', 'last' => 'Little', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Matthew', 'last' => 'Duncan', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Daisy', 'last' => 'Wall', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Louis', 'last' => 'Potts', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Amelie', 'last' => 'Bentley', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Harriet', 'last' => 'Cameron', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Jude', 'last' => 'Fraser', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Aidan', 'last' => 'Farmer', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Rebecca', 'last' => 'Wallace', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Lucas', 'last' => 'Kaur', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Faith', 'last' => 'Bartlett', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Luke', 'last' => 'Cooke', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Lilly', 'last' => 'Farrell', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Peter', 'last' => 'Boyle', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'James', 'last' => 'Kay', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Nicholas', 'last' => 'Morley', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Mason', 'last' => 'Kent', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Sofia', 'last' => 'Freeman', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Isobel', 'last' => 'Watts', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Andrew', 'last' => 'Garner', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Henry', 'last' => 'Farmer', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Louie', 'last' => 'Fowler', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Amy', 'last' => 'Doyle', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Rhys', 'last' => 'Buckley', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Bradley', 'last' => 'Warren', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Sean', 'last' => 'Dennis', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Muhammad', 'last' => 'Murphy', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Nicole', 'last' => 'Robertson', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Aidan', 'last' => 'Hicks', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Abigail', 'last' => 'Page', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Kieran', 'last' => 'Swift', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Isobel', 'last' => 'Austin', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Jake', 'last' => 'Bradley', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Yasmin', 'last' => 'Davey', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Alice', 'last' => 'Shepherd', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Taylor', 'last' => 'Bradshaw', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Kian', 'last' => 'Payne', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Sienna', 'last' => 'Wilkins', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Eleanor', 'last' => 'Collier', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Bradley', 'last' => 'Griffiths', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Jay', 'last' => 'Black', 'tickets' => 1, 'source' => 'EventBrite'));
Booking::create(array('first' => 'Rachel', 'last' => 'Duncan', 'tickets' => 1, 'source' => 'EventBrite'));
//.........这里部分代码省略.........
示例5: getIndex
/**
* Display a listing of the resource.
* GET /reservations
*
* @return Response
*/
public function getIndex()
{
$execResult = ['updated' => 0, 'created' => 0, 'bookings' => 0, 'cancelled' => 0, 'not_mapped' => 0];
$propertiesChannels = PropertiesChannel::where('property_id', Property::getLoggedId())->get();
foreach ($propertiesChannels as $channelSettings) {
Log::debug($channelSettings);
$channel = ChannelFactory::create($channelSettings);
$result = $channel->getReservations();
Log::debug($result);
if ($result['reservations']) {
foreach ($result['reservations'] as $reservation) {
$reservation['channel_id'] = $channelSettings->channel_id;
$reservation['property_id'] = $channelSettings->property_id;
$resModel = Reservation::getByKeys($channelSettings->channel_id, $channelSettings->property_id)->where('res_id', $reservation['res_id'])->first();
if (isset($reservation['cc_details']) && !empty($reservation['cc_details'])) {
$reservation['cc_details'] = Crypt::encrypt($reservation['cc_details']);
}
switch ($reservation['status']) {
case 'cancelled':
if ($resModel) {
$resModel->status = 'cancelled';
if ($reservation['res_cancel_fee']) {
$resModel->res_cancel_fee = $reservation['res_cancel_fee'];
}
$resModel->cancelled_at = $resModel->freshTimestamp();
$resModel->save();
$execResult['cancelled']++;
//TODO: send email about cancellation
}
break;
case 'booked':
$needAddRooms = true;
if ($resModel) {
if (isset($reservation['modified']) && $reservation['modified']) {
$resModel->update($reservation);
$execResult['updated']++;
$resModel->bookings()->delete();
//TODO: send email about modification
} else {
$needAddRooms = false;
}
} else {
$resModel = Reservation::create($reservation);
$execResult['created']++;
}
if ($reservation['rooms'] && $needAddRooms) {
foreach ($reservation['rooms'] as $room) {
$room['reservation_id'] = $resModel->id;
$room['channel_id'] = $reservation['channel_id'];
$room['property_id'] = $reservation['property_id'];
$mapping = InventoryMap::getMappedRoom($channelSettings->channel_id, $channelSettings->property_id, $room['inventory'], isset($room['plan']) ? $room['plan'] : null)->first();
if ($mapping) {
$room['room_id'] = $mapping->room_id;
} else {
$execResult['not_mapped']++;
//TODO: send email about NOT MAPPED ROOM
}
Booking::create($room);
$execResult['bookings']++;
}
}
break;
}
if ($resModel && $resModel->id) {
$type = $resModel->status;
if ($type != 'cancelled' && $resModel->modified) {
$type = 'modify';
}
$channel->setReservationConfirmation($resModel->id, $resModel->res_id, $type);
}
}
}
}
return View::make('index', compact('execResult'));
}
示例6: storeAllData
public function storeAllData()
{
$data = Session::pull('MyBookingData');
if (Session::has('rate_box_details') || Session::has('transport_cart_box') || Session::has('predefined_transport') || Session::has('excursion_cart_details')) {
if ($booking = Booking::create($data)) {
$ehi_users = User::getEhiUsers();
if (Auth::check()) {
//DB::table('booking_user')->insert(array('booking_id' => $booking->id, 'user_id' => $user->id));
if (Session::has('client-list')) {
$clients = Session::pull('client-list');
foreach ($clients as $client) {
$client['booking_id'] = $booking->id;
$client['gender'] === 'male' ? $client['gender'] = 1 : ($client['gender'] = 0);
Client::create($client);
}
}
$flight_data = [];
$flight_data['booking_id'] = $booking->id;
$flight_data['date'] = $data['date_arrival'];
$flight_data['time'] = $data['arrival_time'];
$flight_data['flight'] = $data['arrival_flight'];
$flight_data['flight_type'] = 1;
FlightDetail::create($flight_data);
//departure flight data
$flight_data['date'] = $data['date_departure'];
$flight_data['time'] = $data['departure_time'];
$flight_data['flight'] = $data['departure_flight'];
$flight_data['flight_type'] = 0;
FlightDetail::create($flight_data);
}
/**
* transport - custom trips
*/
$a = 0;
if (Session::has('transport_cart_box')) {
$custom_trips = Session::pull('transport_cart_box');
$a++;
$x = 1;
foreach ($custom_trips as $custom_trip) {
$custom_trip['from'] = date('Y-m-d H:i', strtotime($custom_trip['pick_up_date'] . ' ' . $custom_trip['pick_up_time_hour'] . ':' . $custom_trip['pick_up_time_minutes']));
$custom_trip['to'] = date('Y-m-d H:i', strtotime($custom_trip['drop_off_date'] . ' ' . $custom_trip['drop_off_time_hour'] . ':' . $custom_trip['drop_off_time_minutes']));
$custom_trip['reference_number'] = 'TR' . ($booking->reference_number * 1000 + $x++);
$custom_trip['booking_id'] = $booking->id;
$custom_trip['locations'] = $custom_trip['destination_1'] . ',' . $custom_trip['destination_2'] or '' . ',' . $custom_trip['destination_3'];
$custom_trip['amount'] = rand(100, 200);
CustomTrip::create($custom_trip);
}
}
/**
* predefined package bookings
*/
if (Session::has('predefined_transport')) {
$a++;
$predefined_packages = Session::pull('predefined_transport');
foreach ($predefined_packages as $predefined_package) {
$package = [];
$package['transport_package_id'] = $predefined_package['predefine_id'];
$package['booking_id'] = $booking->id;
$package['pick_up_date_time'] = $predefined_package['check_in_date'];
$package['amount'] = TransportPackage::find($predefined_package['predefine_id'])->rate;
PredefinedTrip::create($package);
}
}
/**
* Send Transportation Email to All EHI users
*/
$pdf = PDF::loadView('emails/transport', array('booking' => $booking));
$pdf->save('public/temp-files/transport' . $booking->id . '.pdf');
// if ($a > 0) {
// Mail::send('emails/transport-mail', array(
// 'booking' => Booking::find($booking->id)
// ), function ($message) use ($booking, $ehi_users) {
// $message->attach('public/temp-files/transport.pdf')
// ->subject('New Transfer : ' . $booking->reference_number)
// ->from('transport@srilankahotels.travel', 'SriLankaHotels.Travel')
// ->bcc('admin@srilankahotels.travel');
// if (!empty($ehi_users))
// foreach ($ehi_users as $ehi_user) {
// $message->to($ehi_user->email, $ehi_user->first_name);
// }
// });
// }
/**
* Excursions
*/
if (Session::has('excursion_cart_details')) {
$excursions = Session::pull('excursion_cart_details');
$x = 1;
foreach ($excursions as $excursion) {
$excursionBooking = ExcursionRate::with(array('city', 'excursion', 'excursionTransportType'))->where('city_id', $excursion['city_id'])->where('excursion_transport_type_id', $excursion['excursion_transport_type'])->where('excursion_id', $excursion['excursion'])->first();
$excursionBookingData = array('booking_id' => $booking->id, 'city_id' => $excursionBooking->city_id, 'excursion_transport_type_id' => $excursionBooking->excursion_transport_type_id, 'excursion_id' => $excursionBooking->excursion_id, 'unit_price' => $excursionBooking->rate, 'pax' => $excursion['excursion_pax'], 'date' => $excursion['excursion_date'], 'reference_number' => 'EX' . ($booking->reference_number * 1000 + $x++));
ExcursionBooking::create($excursionBookingData);
}
$pdf = PDF::loadView('emails/excursion', array('booking' => $booking));
$pdf->save('public/temp-files/excursions.pdf');
// Mail::send('emails/excursion-mail', array(
// 'booking' => $booking
// ), function ($message) use ($booking, $ehi_users) {
// $message->attach('public/temp-files/excursions.pdf')
// ->subject('New Excursions : ' . $booking->reference_number)
//.........这里部分代码省略.........
示例7: store
/**
* Store a newly created payment in storage.
*
* @return Response
*/
public function store()
{
$data = Input::all();
$user_id = Auth::id();
$validator = Validator::make(Input::all(), array('amount' => 'required|numeric'));
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
/**
* Payments are starting from "BK" numbers
*/
if ($x = Payment::find(Payment::max('id'))) {
$y = (int) substr($x->reference_number, 2);
$data['reference_number'] = 'BK' . ++$y;
} else {
$data['reference_number'] = 'BK10000000';
}
$data['agent_id'] = User::getAgentOfUser(Auth::id());
if (Entrust::hasRole('Agent')) {
$agent_id = $data['agent_id']->user_id;
$name = User::where('id', $user_id)->first()->first_name . ' ' . User::where('id', $user_id)->first()->last_name;
$email = User::where('id', $user_id)->first()->email;
$phone = Agent::where('user_id', $user_id)->first()->phone;
$amount = Input::get('amount');
$details = Input::get('details');
$data = array('details' => $name, 'ip_address' => $_SERVER['REMOTE_ADDR'], 'amount' => $amount, 'payment_status' => 0, 'my_booking' => 2);
$reserv_id = Payment::create($data);
$data_tab_HSBC_payment = array('currency' => 'USD');
$tab_HSBC_payment_id = HsbcPayment::create($data_tab_HSBC_payment);
$stamp = strtotime("now");
$payment_id = Payment::orderBy('created_at', 'desc')->first()->id;
$orderid = "{$stamp}" . 'AP' . "{$payment_id}";
$last_res_resid = str_replace(".", "", $orderid);
$hsbc_id = HsbcPayment::orderBy('created_at', 'desc')->first()->id;
$hsbc_payment_id_pre = "{$stamp}" . 'HSBC' . "{$hsbc_id}";
$hsbc_payment_id = str_replace(".", "", $hsbc_payment_id_pre);
if ($last_res_resid) {
$payment = DB::table('payments')->where('id', $payment_id)->update(array('reference_number' => $last_res_resid, 'HSBC_payment_id' => $hsbc_payment_id));
$data_tab_HSBC_payment = DB::table('hsbc_payments')->where('id', $hsbc_id)->update(array('HSBC_payment_id' => $hsbc_payment_id));
$client = array('booking_name' => $name, 'email' => $email, 'phone' => $phone, 'remarks' => $details, 'val' => 0, 'payment_reference_number' => $last_res_resid);
$client_payment_id = Booking::create($client);
}
$currency = 'USD';
$x = $amount * 1.037;
$total_price_all_hsbc = round($x, 2) * 100;
//dd($hsbc_payment_id . '/' . $currency . '/' . $total_price_all_hsbc . '/' . $last_res_resid);
HsbcPayment::goto_hsbc_gateway($hsbc_payment_id, $currency, $total_price_all_hsbc, $last_res_resid);
// return $this->storeAllDataAndSendEmails();
}
//Payment::create($data);
return Redirect::route('accounts.payments.index');
}