当前位置: 首页>>代码示例>>PHP>>正文


PHP Client::create方法代码示例

本文整理汇总了PHP中Client::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::create方法的具体用法?PHP Client::create怎么用?PHP Client::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Client的用法示例。


在下文中一共展示了Client::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Client::create([]);
     }
 }
开发者ID:kenkode,项目名称:xaraerp,代码行数:7,代码来源:ClientsTableSeeder.php

示例2: create

 public function create()
 {
     if (isset($_POST['name']) && !empty($_POST['name'])) {
         $obj = new Client();
         $error = array();
         $obj->name = strip_tags($_POST['name']);
         $obj->addy = strip_tags($_POST['addy']);
         $obj->visible = $_POST['visible'];
         $obj->phone = $_POST['phone'];
         $obj->email = $_POST['email'];
         $obj->descr = $_POST['desc'];
         $obj->username = $_POST['username'];
         if ($_POST['password'] == $_POST['r_password']) {
             $obj->password = $_POST['password'];
         } else {
             array_push($error, "Password do not match");
         }
         if (empty($error)) {
             if ($obj->create()) {
                 return 1;
             } else {
                 return 2;
             }
         }
     }
 }
开发者ID:runningjack,项目名称:RobertJohnson,代码行数:26,代码来源:clients_model.php

示例3: store

 /**
  * Store a newly created client in storage.
  *
  * @return Response
  */
 public function store($bookingId)
 {
     $user = Auth::user();
     $validator = Validator::make($data = Input::all(), Client::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $data['booking_id'] = $bookingId;
     if ($bookingdata = Client::create($data)) {
         $booking = Booking::getBookingData($bookingdata->booking_id);
         $pdf = PDF::loadView('emails/booking', array('booking' => $booking));
         $pdf->save(public_path() . '/temp-files/booking' . $booking->id . '.pdf');
         $emails = array('tharinda@exotic-intl.com', 'lahiru@exotic-intl.com', 'umesh@exotic-intl.com');
         $ehi_users = User::getEhiUsers();
         Mail::send('emails/booking-mail', array('booking' => Booking::getBookingData($booking->id)), function ($message) use($booking, $emails, $ehi_users) {
             $message->attach(public_path() . '/temp-files/booking' . $booking->id . '.pdf')->subject('Amended Booking(Client Added): ' . $booking->reference_number)->from('noreply@srilankahotels.com', 'SriLankaHotels.Travel')->bcc('admin@srilankahotels.travel', 'Admin');
             foreach ($emails as $emailaddress) {
                 $message->to($emailaddress, 'Admin');
             }
             if (!empty($ehi_users)) {
                 foreach ($ehi_users as $ehi_user) {
                     $message->to($ehi_user->email, $ehi_user->first_name);
                 }
             }
         });
     }
     return Redirect::route('bookings.show', $bookingId);
 }
开发者ID:tharindarodrigo,项目名称:agent,代码行数:33,代码来源:ClientsController.php

示例4: run

 public function run()
 {
     $faker = Faker\Factory::create();
     Client::truncate();
     foreach (range(1, 10) as $index) {
         Client::create(['user_id' => 2, 'name' => $faker->name, 'email' => $faker->email, 'address_1' => $faker->streetAddress, 'city' => $faker->city, 'zip' => $faker->postcode, 'country_id' => 840, 'phone' => $faker->phoneNumber, 'web' => $faker->url]);
     }
 }
开发者ID:mladjom,项目名称:smartinvoice,代码行数:8,代码来源:ClientsTableSeeder.php

示例5: __construct

 function __construct()
 {
     // String is needed for the comparison
     if (getenv('FB_INSTANT_ARTICLES_DEVELOPMENT_MODE') === "false") {
         $development_mode = false;
     } else {
         $development_mode = true;
     }
     $this->client = Client::create(get_option('instant_articles_app_id'), get_option('instant_articles_app_secret'), get_option('instant_articles_page_token'), get_option('instant_articles_page_id'), $development_mode);
 }
开发者ID:shortlist-digital,项目名称:agreable-instant-articles-plugin,代码行数:10,代码来源:ClientProvider.php

示例6: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $rules = array('company' => 'required|min:3', 'firstname' => 'required|min:3', 'lastname' => 'required|min:3', 'email' => 'required|email|unique:clients', 'phone' => 'required|min:6|phone|unique:clients', 'address' => 'required|min:3');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->passes()) {
         Client::create(Input::except('_token'));
         return Redirect::to('clients')->with('success', 'Client created successfully');
     } else {
         return Redirect::to('clients/create')->withErrors($validator)->withInput();
     }
 }
开发者ID:x4rMa,项目名称:Vehicle-Inspection-System,代码行数:16,代码来源:ClientController.php

示例7: run

 public function run()
 {
     //se ingresa el libro de darwin
     //DB::statement("INSERT INTO lor_lecture (title, author, year, publisher, content, created_at, updated_at, deleted_at) VALUES ('El origen de las especies', 'Charles Darwin', '1859', 'Dominio publico', 'temas vivos.', NOW(),NOW(), NULL);");
     $user = User::create(array('profile' => 'super_admin', 'firstname' => 'Alexander Andres Londono Espejo', 'username' => 'admin', 'email' => 'admin@admin.com', 'password' => Hash::make('admin')));
     $user->roles()->attach(1);
     $user->roles()->attach(2);
     $user->roles()->attach(3);
     $user->roles()->attach(4);
     $user->roles()->attach(5);
     $user->roles()->attach(6);
     $user->roles()->attach(7);
     $user->roles()->attach(8);
     $user->roles()->attach(9);
     $user->roles()->attach(10);
     $user->roles()->attach(11);
     $user->roles()->attach(12);
     $user->roles()->attach(13);
     $user->roles()->attach(14);
     $user->roles()->attach(15);
     $user->roles()->attach(16);
     $user->roles()->attach(17);
     $user->roles()->attach(18);
     $user->roles()->attach(19);
     $user->roles()->attach(20);
     $user->roles()->attach(21);
     $user->roles()->attach(22);
     $user->roles()->attach(23);
     $user->roles()->attach(24);
     $user->roles()->attach(25);
     $user->roles()->attach(26);
     $user->roles()->attach(27);
     $user->roles()->attach(28);
     $user->roles()->attach(29);
     $user->roles()->attach(30);
     $user->roles()->attach(31);
     $user->roles()->attach(32);
     $faker = Faker\Factory::create();
     $count_client = 50;
     foreach (range(1, $count_client) as $index) {
         $user = User::create(['firstname' => $faker->firstName, 'lastname' => $faker->lastName, 'username' => 'admin' . $index, 'email' => $faker->email, 'identification' => $faker->numberBetween(19999999, 99999999), 'password' => Hash::make('admin' . $index)]);
         //Ingreso datos de prueba de clientes
         $client = Client::create(['name' => $faker->company, 'address' => 'Caucasia Antioquia', 'enable' => 'SI']);
         //Ingreso datos de prueba de proveedores
         $provider = Provider::create(['name' => $faker->company, 'email' => $faker->email, 'telephone' => $faker->numberBetween(19999999, 99999999), 'country' => 'Colombia', 'department' => 'Antioquia', 'city' => 'Medellin', 'enable' => 'SI']);
         //Ingreso datos de prueba de costos
         $costs = Cost::create(['name' => $faker->company, 'type' => 'Otro', 'value' => $faker->numberBetween(1999, 99999), 'description' => $faker->company, 'resposible' => 'Alexander', 'enable' => 'SI']);
         //Ingreso datos de prueba de categoria
         $category = Category::create(['name' => $faker->company, 'description' => '', 'enable' => 'SI']);
         //Ingreso datos de prueba de productos
         $product = Product::create(['name' => $faker->company, 'description' => '', 'cost' => $faker->numberBetween(1999, 9999), 'value' => $faker->numberBetween(19999, 99999), 'enable' => 'SI']);
     }
 }
开发者ID:alexlondon07,项目名称:accounting,代码行数:53,代码来源:DevelopmentTableSeeder.php

示例8: create

 function create($company_id = FALSE)
 {
     if ($_POST) {
         $config['upload_path'] = './files/media/';
         $config['encrypt_name'] = TRUE;
         $config['allowed_types'] = 'gif|jpg|png';
         $config['max_width'] = '180';
         $config['max_height'] = '180';
         $this->load->library('upload', $config);
         if ($this->upload->do_upload()) {
             $data = array('upload_data' => $this->upload->data());
             $_POST['userpic'] = $data['upload_data']['file_name'];
         } else {
             $error = $this->upload->display_errors('', ' ');
             if ($error != "You did not select a file to upload. ") {
                 $this->session->set_flashdata('message', 'error:' . $error);
                 redirect('clients');
             }
         }
         unset($_POST['send']);
         unset($_POST['userfile']);
         unset($_POST['file-name']);
         if (isset($_POST["access"])) {
             $_POST["access"] = implode(",", $_POST["access"]);
         } else {
             unset($_POST["access"]);
         }
         $_POST = array_map('htmlspecialchars', $_POST);
         $_POST["company_id"] = $company_id;
         $client = Client::create($_POST);
         $client->password = $client->set_password($_POST['password']);
         $client->save();
         if (!$client) {
             $this->session->set_flashdata('message', 'error:' . $this->lang->line('messages_client_add_error'));
         } else {
             $this->session->set_flashdata('message', 'success:' . $this->lang->line('messages_client_add_success'));
             $company = Company::find($company_id);
             if (!isset($company->client->id)) {
                 $client = Client::last();
                 $company->update_attributes(array('client_id' => $client->id));
             }
         }
         redirect('clients/view/' . $company_id);
     } else {
         $this->view_data['clients'] = Client::find('all', array('conditions' => array('inactive=?', '0')));
         $this->view_data['modules'] = Module::find('all', array('order' => 'sort asc', 'conditions' => array('type = ?', 'client')));
         $this->view_data['next_reference'] = Client::last();
         $this->theme_view = 'modal';
         $this->view_data['title'] = $this->lang->line('application_add_new_contact');
         $this->view_data['form_action'] = 'clients/create/' . $company_id;
         $this->content_view = 'clients/_clients';
     }
 }
开发者ID:timclifford,项目名称:freelance-manager,代码行数:53,代码来源:clients.php

示例9: doInsert

function doInsert()
{
    if (isset($_POST['submit'])) {
        $CLIENTNAME = $_POST['name'];
        $SHORTNAME = $_POST['shortname'];
        $ADDRESS = $_POST['address'];
        $EMAIL = $_POST['email'];
        $TELEPHONE = $_POST['telephone'];
        $WEBSITE = $_POST['website'];
        $SECTOR = $_POST['sector'];
        $client = new Client();
        $client->client_name = $CLIENTNAME;
        $client->client_short_name = $SHORTNAME;
        $client->client_address = $ADDRESS;
        $client->client_email = $EMAIL;
        $client->client_Telephone = $TELEPHONE;
        $client->client_website = $WEBSITE;
        $client->client_sector = $SECTOR;
    }
    if ($CLIENTNAME == "") {
        message('Name is required!', "error");
        redirect('index.php?view=add');
    } elseif ($SHORTNAME == "") {
        message('Short Name is required!', "error");
        redirect('index.php?view=add');
    } elseif ($ADDRESS == "") {
        message('Address Name is required!', "error");
        redirect('index.php?view=add');
    } elseif ($SECTOR == "") {
        message('Sector name is required!', "error");
        redirect('index.php?view=add');
    } elseif ($WEBSITE == "") {
        message('Website is required!', "error");
        redirect('index.php?view=add');
    } elseif ($TELEPHONE == "") {
        message('Telephone is required!', "error");
        redirect('index.php?view=add');
    } elseif ($EMAIL == "") {
        message('Email is required!', "error");
        redirect('index.php?view=add');
    }
    $client->create();
    message('New client addedd successfully!', "success");
    redirect('index.php?view=list');
}
开发者ID:allybitebo,项目名称:ucb,代码行数:45,代码来源:controller.php

示例10: add_admin

function add_admin($pass)
{
    global $gbl, $sgbl, $login, $ghtml;
    $client = new Client(null, null, 'admin');
    $login = $client;
    $client->initThisDef();
    $client->priv->pserver_num = 'Unlimited';
    $client->priv->maindomain_num = 'Unlimited';
    $client->priv->vps_num = 'Unlimited';
    $client->priv->client_num = 'Unlimited';
    $client->ddate = time();
    $ddb = new Sqlite(null, "client");
    if (!$ddb->existInTable("nname", 'admin')) {
        if ($sgbl->dbg > 0) {
            $pass = 'lxlabs';
            $res['contacemail'] = 'admin@lxcenter.org';
        }
        $res['password'] = crypt($pass);
        $res['cttype'] = 'admin';
        $res['cpstatus'] = 'on';
        if (if_demo()) {
            $res['email'] = "admin@lxcenter.org";
        }
        $client->create($res);
        $client->driverApp = new client__sync(null, null, 'admin');
        $client->was();
        lxfile_mkdir("__path_client_root/{$client->nname}");
        lxfile_generic_chown("__path_client_root/{$client->nname}", "lxlabs");
    }
    $notif = new Notification(null, null, $client->getClName());
    $notif->initThisDef();
    $notif->dbaction = 'add';
    $notif->text_newaccountmessage = lfile_get_contents("__path_program_root/file/welcome.txt");
    $notif->parent_clname = $client->getClName();
    $notif->write();
    $display = new sp_SpecialPlay(null, null, $client->getClName());
    $display->initThisDef();
    $display->parent_clname = $client->getClName();
    $display->dbaction = 'add';
    $display->write();
}
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:41,代码来源:initlib.php

示例11: index

 function index()
 {
     $core_settings = Setting::first();
     if ($core_settings->registration != 1) {
         redirect('login');
     }
     if ($_POST) {
         $this->load->library('parser');
         $this->load->helper('file');
         $this->load->helper('notification');
         $client = Client::find_by_email($_POST['email']);
         if ($client->inactive == 1) {
             $client = FALSE;
         }
         $check_company = Company::find_by_name($_POST['name']);
         if (!$client && !$check_company && $_POST['name'] != "" && $_POST['email'] != "" && $_POST['password'] != "" && $_POST['firstname'] != "" && $_POST['lastname'] != "" && $_POST['confirmcaptcha'] != "") {
             $client_attr = array();
             $company_attr['name'] = $_POST['name'];
             $company_attr['website'] = $_POST['website'];
             $company_attr['phone'] = $_POST['phone'];
             $company_attr['mobile'] = $_POST['mobile'];
             $company_attr['address'] = $_POST['address'];
             $company_attr['zipcode'] = $_POST['zipcode'];
             $company_attr['city'] = $_POST['city'];
             $company_attr['country'] = $_POST['country'];
             $company_attr['province'] = $_POST['province'];
             $company_attr['vat'] = $_POST['vat'];
             $company_attr['reference'] = $core_settings->company_reference;
             $core_settings->company_reference = $core_settings->company_reference + 1;
             $core_settings->save();
             $company = Company::create($company_attr);
             if (!$company) {
                 $this->session->set_flashdata('message', 'success:' . $this->lang->line('messages_registration_error'));
                 redirect('register');
             }
             $lastclient = Client::last();
             $client_attr = array();
             $client_attr['email'] = $_POST['email'];
             $client_attr['firstname'] = $_POST['firstname'];
             $client_attr['lastname'] = $_POST['lastname'];
             $client_attr['phone'] = $_POST['phone'];
             $client_attr['mobile'] = $_POST['mobile'];
             $client_attr['address'] = $_POST['address'];
             $client_attr['zipcode'] = $_POST['zipcode'];
             $client_attr['city'] = $_POST['city'];
             $modules = Module::find('all', array('order' => 'sort asc', 'conditions' => array('type = ?', 'client')));
             $client_attr['access'] = "";
             foreach ($modules as $value) {
                 if ($value->name == "Projects" || $value->name == "Messages" || $value->name == "Tickets" || $value->name == "Invoices") {
                     $client_attr['access'] .= $value->id . ",";
                 }
             }
             $client_attr['company_id'] = $company->id;
             $client = Client::create($client_attr);
             if ($client) {
                 $client->password = $client->set_password($_POST['password']);
                 $client->save();
                 $company->client_id = $client->id;
                 $company->save();
                 $this->email->from($core_settings->email, $core_settings->company);
                 $this->email->to($client_attr['email']);
                 $this->email->subject($this->lang->line('application_your_account_has_been_created'));
                 $parse_data = array('link' => base_url() . 'login/', 'company' => $core_settings->company, 'company_reference' => $company->reference, 'logo' => '<img src="' . base_url() . '' . $core_settings->logo . '" alt="' . $core_settings->company . '"/>', 'invoice_logo' => '<img src="' . base_url() . '' . $core_settings->invoice_logo . '" alt="' . $core_settings->company . '"/>');
                 $email = read_file('./application/views/' . $core_settings->template . '/templates/email_create_account.html');
                 $message = $this->parser->parse_string($email, $parse_data);
                 $this->email->message($message);
                 $this->email->send();
                 send_notification($core_settings->email, $this->lang->line('application_new_client_has_registered'), $this->lang->line('application_new_client_has_registered') . ': <br><strong>' . $company_attr['name'] . '</strong><br>' . $client_attr['firstname'] . ' ' . $client_attr['lastname'] . '<br>' . $client_attr['email']);
                 $this->session->set_flashdata('message', 'success:' . $this->lang->line('messages_registration_success'));
                 redirect('login');
             } else {
                 $this->session->set_flashdata('message', 'success:' . $this->lang->line('messages_registration_error'));
                 redirect('login');
             }
         } else {
             $this->view_data['error'] = $this->lang->line('messages_email_already_taken');
             $this->theme_view = 'login';
             $this->content_view = 'auth/register';
             $this->view_data['form_action'] = 'register';
             $this->view_data['registerdata'] = $_POST;
         }
     } else {
         $this->view_data['error'] = 'false';
         $this->theme_view = 'login';
         $this->content_view = 'auth/register';
         $this->view_data['form_action'] = 'register';
     }
 }
开发者ID:imranweb7,项目名称:msitc-erp,代码行数:88,代码来源:register.php

示例12: seedTestUsersAndClients

 private function seedTestUsersAndClients()
 {
     $resource_server = ResourceServer::first();
     // create users and clients ...
     User::create(array('identifier' => 'sebastian.marcet', 'external_identifier' => 13867, 'last_login_date' => gmdate("Y-m-d H:i:s", time())));
     $user = User::where('identifier', '=', 'sebastian.marcet')->first();
     OpenIdTrustedSite::create(array('user_id' => $user->id, 'realm' => 'https://www.test.com/', 'policy' => IAuthService::AuthorizationResponse_AllowForever));
     Client::create(array('app_name' => 'oauth2_test_app', 'app_description' => 'oauth2_test_app', 'app_logo' => null, 'client_id' => 'Jiz87D8/Vcvr6fvQbH4HyNgwTlfSyQ3x.openstack.client', 'client_secret' => 'ITc/6Y5N7kOtGKhg', 'client_type' => IClient::ClientType_Confidential, 'application_type' => IClient::ApplicationType_Web_App, 'user_id' => $user->id, 'rotate_refresh_token' => true, 'use_refresh_token' => true));
     Client::create(array('app_name' => 'oauth2.service', 'app_description' => 'oauth2.service', 'app_logo' => null, 'client_id' => '11z87D8/Vcvr6fvQbH4HyNgwTlfSyQ3x.openstack.client', 'client_secret' => '11c/6Y5N7kOtGKhg', 'client_type' => IClient::ClientType_Confidential, 'application_type' => IClient::ApplicationType_Service, 'user_id' => $user->id, 'rotate_refresh_token' => true, 'use_refresh_token' => true));
     Client::create(array('app_name' => 'oauth2_test_app_public', 'app_description' => 'oauth2_test_app_public', 'app_logo' => null, 'client_id' => 'Jiz87D8/Vcvr6fvQbH4HyNgwKlfSyQ3x.openstack.client', 'client_secret' => null, 'client_type' => IClient::ClientType_Public, 'application_type' => IClient::ApplicationType_JS_Client, 'user_id' => $user->id, 'rotate_refresh_token' => false, 'use_refresh_token' => false));
     Client::create(array('app_name' => 'oauth2_test_app_public_2', 'app_description' => 'oauth2_test_app_public_2', 'app_logo' => null, 'client_id' => 'Jiz87D8/Vcvr6fvQbH4HyNgwKlfSyQ2x.openstack.client', 'client_secret' => null, 'client_type' => IClient::ClientType_Public, 'application_type' => IClient::ApplicationType_JS_Client, 'user_id' => $user->id, 'rotate_refresh_token' => false, 'use_refresh_token' => false));
     Client::create(array('app_name' => 'resource_server_client', 'app_description' => 'resource_server_client', 'app_logo' => null, 'client_id' => 'resource.server.1.openstack.client', 'client_secret' => '123456789', 'client_type' => IClient::ClientType_Confidential, 'application_type' => IClient::ApplicationType_Service, 'resource_server_id' => $resource_server->id, 'rotate_refresh_token' => false, 'use_refresh_token' => false));
     $client_confidential = Client::where('app_name', '=', 'oauth2_test_app')->first();
     $client_public = Client::where('app_name', '=', 'oauth2_test_app_public')->first();
     $client_service = Client::where('app_name', '=', 'oauth2.service')->first();
     //attach scopes
     $scopes = ApiScope::get();
     foreach ($scopes as $scope) {
         $client_confidential->scopes()->attach($scope->id);
         $client_public->scopes()->attach($scope->id);
         $client_service->scopes()->attach($scope->id);
     }
     //add uris
     ClientAuthorizedUri::create(array('uri' => 'https://www.test.com/oauth2', 'client_id' => $client_confidential->id));
     //add uris
     ClientAllowedOrigin::create(array('allowed_origin' => 'https://www.test.com/oauth2', 'client_id' => $client_confidential->id));
     ClientAuthorizedUri::create(array('uri' => 'https://www.test.com/oauth2', 'client_id' => $client_public->id));
 }
开发者ID:smarcet,项目名称:openstackid,代码行数:28,代码来源:TestSeeder.php

示例13: start

 protected function start()
 {
     $node = new Node();
     $node->create();
     $task = new Task();
     $task->create();
     $client = new Client();
     $hash = $client->create();
     $response = array("status" => "Running", 'ClientHash' => $hash);
     $this->response->out($response);
 }
开发者ID:DenDugin,项目名称:grid,代码行数:11,代码来源:App.php

示例14: createClient

 /**
  * Create http client for request handle
  *
  * @param  array  $options
  * @return void
  */
 public static function createClient(array $options = [])
 {
     Client::create(array_merge($options, ['base_uri' => static::baseUri(), 'auth' => static::auth()]));
 }
开发者ID:loduis,项目名称:alegra-php,代码行数:10,代码来源:Api.php

示例15: 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)
//.........这里部分代码省略.........
开发者ID:tharindarodrigo,项目名称:agent,代码行数:101,代码来源:BookingsController.php


注:本文中的Client::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。