本文整理汇总了PHP中Driver::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Driver::create方法的具体用法?PHP Driver::create怎么用?PHP Driver::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Driver
的用法示例。
在下文中一共展示了Driver::create方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
/**
* Creates a new session
*
* @return boolean
*/
public function create()
{
// reset the data containers
$this->reset();
// and create a new session
return $this->driver->create();
}
示例2: adddriver
public function adddriver()
{
$input = Input::json();
$authorized_license_no = $input->get('dlic');
$authorized_status = Driver::where('drivers_license_no', $authorized_license_no)->count();
//print_r($input);
if ($authorized_status == NULL) {
$country_id = DB::table('countries')->where('country_name', $input->get('country'))->first()->id;
$status_id = DB::table('driving_status')->where('driving_status_name', $input->get('status'))->first()->id;
$authorized_info['drivers_fname'] = $input->get('fname');
$authorized_info['drivers_mname'] = $input->get('mname');
$authorized_info['drivers_lname'] = $input->get('lname');
$authorized_info['drivers_nin'] = $input->get('nin');
$authorized_info['drivers_license_no'] = $input->get('dlic');
$authorized_info['drivers_street'] = $input->get('street');
$authorized_info['drivers_city'] = $input->get('city');
$authorized_info['drivers_po_box'] = $input->get('po');
$authorized_info['drivers_country'] = $country_id;
$authorized_info['drivers_cell1'] = $input->get('cell1');
$authorized_info['drivers_cell2'] = $input->get('cell2');
$authorized_info['drivers_email'] = $input->get('email');
$authorized_info['drivers_driving_status'] = $status_id;
$insert_authorized_into_driver_table = Driver::create($authorized_info);
$authorized_ids = $insert_authorized_into_driver_table->id;
$driver_name = $insert_authorized_into_driver_table->drivers_fname . ' ' . $insert_authorized_into_driver_table->drivers_lname;
} else {
$driver = Driver::where('drivers_license_no', $authorized_license_no)->first();
$authorized_ids = $driver->id;
$driver_name = $driver->drivers_fname . ' ' . $driver->drivers_lname;
}
$info = array('driver_id' => $authorized_ids, 'name' => $driver_name);
//send driver id in response
Helpers::response_data('200', 'success', $info);
}
示例3: changeOwnerUpdate
public function changeOwnerUpdate($id)
{
// FIND OLD VEHICLE AND CREATE RESPECTIVE LOGS
$oldVehicle = Vehicle::find($id);
/*
// IF VEHICLE STATUS IS CHANGED, ADD OLD STATUS IN LOG AND UPDATE DATA
if($oldVehiclesStatus != $newVehiclesStatus){
LogVehicleStatus::create(['log_vehicle_status_vehicle_id' => $id, 'log_vehicle_status_vehicle_status_id' => $oldVehiclesStatus]);
}
// IF VEHICLE COLOR IS CHANGED, ADD OLD COLOR IN LOG AND UPDATE DATA
if($oldvehicleColor != $newVehicleColor){
LogVehicleColor::create(['log_vehicle_color_vehicle_id' => $id, 'log_vehicle_color_color_id' => $oldvehicleColor]);
}
// IF VEHICLE USE TYPE IS CHANGED, ADD OLD USE TYPE IN LOG AND UPDATE DATA
if($oldVehicleUseType != $newVehicleUseType){
$oldRegistrations_no = $oldVehicle->registration->registrations_no;
LogVehicleUseType::create(['log_vehicle_use_type_vehicle_id' => $id, 'log_vehicle_use_type_use_type' => $oldVehicleUseType, 'log_vehicle_use_type_registration_no' => $oldRegistrations_no]);
}
*
// TAKE LOG OF ODOMETER
$vehicles_odometer = trim(Input::get('vehicles_odometer'));
$oldOdometer = Vehicle::find($id)->vehicles_odometer;
LogVehicleOdometer::create(['log_vehicle_odometer_vehicle_id' => $id, 'log_vehicle_odometer_old_odometer' => $oldOdometer]);
*/
//VEHICLE DATA
$vehicles_year = trim(Input::get('vehicles_year'));
$vehicles_make_id = trim(Input::get('vehicles_make_id'));
$vehicles_name_trim = trim(Input::get('vehicles_name_trim'));
$vehicles_name_trim_ar = explode(',', $vehicles_name_trim);
$model_name = trim($vehicles_name_trim_ar[0]);
if (count($vehicles_name_trim_ar) > 1) {
$model_trim = trim($vehicles_name_trim_ar[1]);
} else {
$model_trim = "";
}
$vehicles_body = trim(Input::get('vehicles_body'));
if ($vehicles_body == -1) {
$vehicles_body = "";
}
$vehicles_weight_kg = trim(Input::get('vehicles_weight_kg'));
// BEGIN VEHICLE
// IF VEHICLE BODY IS NOT BLANK THEN ADD BODY, ELSE IGNORE IT TO MAKE IT NULL
if ($vehicles_body != "") {
$vehicle = Input::only(['vehicles_vin', 'vehicles_year', 'vehicles_make_id', 'vehicles_name_trim', 'vehicles_body', 'vehicles_weight_kg', 'vehicles_use_type', 'vehicles_use_type', 'vehicles_class', 'vehicles_color', 'vehicles_status', 'vehicles_odometer']);
} else {
$vehicle = Input::only(['vehicles_vin', 'vehicles_year', 'vehicles_make_id', 'vehicles_name_trim', 'vehicles_weight_kg', 'vehicles_use_type', 'vehicles_use_type', 'vehicles_class', 'vehicles_color', 'vehicles_status', 'vehicles_odometer']);
}
//$validator_vehicle = Validator::make($vehicle, Vehicle::$rules);
//if($validator_vehicle->passes()){
// GETTING AND ADDING MODEL ID
// IF BODY IS NULL
if ($vehicles_body == "") {
// GETTING MODEL
$vehicle['vehicles_model_id'] = Model::where('model_year', $vehicles_year)->where('model_make_id', $vehicles_make_id)->where('model_name', $model_name)->where('model_trim', $model_trim)->whereNull('model_body')->first()->id;
} else {
$vehicle['vehicles_model_id'] = Model::where('model_year', $vehicles_year)->where('model_make_id', $vehicles_make_id)->where('model_name', $model_name)->where('model_trim', $model_trim)->where('model_body', $vehicles_body)->first()->id;
}
// INSERT VEHICLE DATA AND GET ID
$vehicle_inserted_id = Vehicle::create($vehicle)->id;
//}else
// return Redirect::route('vehicle.create')->withErrors($validator_vehicle)->withInput();
// END VEHICLE
// ASSOCTIATE NEW VEHICLE AND THEN DELETE OLD VEHICLE DATA
$old_vehicle = Vehicle::find($id);
// ASSOCIATE NEW VEHICLE WITH OLD VEHICLE
$old_vehicle->update(['vehicles_transfer' => $vehicle_inserted_id]);
// DELETE INSURANCE
if ($old_vehicle->insurance) {
$old_vehicle->insurance->delete();
}
// DELETE LIEN
if ($old_vehicle->lien) {
$old_vehicle->lien->delete();
}
// DELETE REGISTRATION
$old_vehicle->registration->delete();
// DELETE VEHICLE
$old_vehicle->delete();
// BEGIN OWNERS
$owners_index = Input::get('owners_index');
$owners_index_arr = array_filter(explode(',', $owners_index));
// LOOP THROUGH EACH OWNER AND ASSOCIATE WITH DRIVERS
foreach ($owners_index_arr as $owners_index_id) {
$drivers_license_no = Input::get('drivers_license_no' . $owners_index_id);
if (trim($drivers_license_no) != "") {
$drivers_status = Driver::where('drivers_license_no', $drivers_license_no)->first();
// IF DRIVER DOESN'T EXISTS, CREATE DRIVER
if ($drivers_status == NULL) {
$owner_info['drivers_fname'] = Input::get('drivers_fname' . $owners_index_id);
$owner_info['drivers_mname'] = Input::get('drivers_mname' . $owners_index_id);
$owner_info['drivers_lname'] = Input::get('drivers_lname' . $owners_index_id);
$owner_info['drivers_nin'] = Input::get('drivers_nin' . $owners_index_id);
$owner_info['drivers_license_no'] = Input::get('drivers_license_no' . $owners_index_id);
$owner_info['drivers_street'] = Input::get('drivers_street' . $owners_index_id);
$owner_info['drivers_city'] = Input::get('drivers_city' . $owners_index_id);
$owner_info['drivers_po_box'] = Input::get('drivers_po_box' . $owners_index_id);
$owner_info['drivers_country'] = Input::get('drivers_country' . $owners_index_id);
//.........这里部分代码省略.........
示例4: driver
/**
* create a new driver instance for current task
* @return null|static
* @throws TaskBalancerException
*/
public function driver()
{
$args = func_get_args();
if (!count($args)) {
throw new TaskBalancerException('Please give task`s method `driver` some args');
}
extract($this->parseDriverArgs($args));
if (!$name) {
throw new TaskBalancerException('Please give the new driver a unique name!');
}
$driver = $this->getDriver($name);
if (!$driver) {
$this->callHookHandler('beforeCreateDriver');
$driver = Driver::create($this, $name, $weight, $isBackup, $work);
$this->drivers[$name] = $driver;
if ($isBackup) {
$this->backupDrivers[] = $name;
}
$this->callHookHandler('afterCreateDriver');
}
return $driver;
}