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


PHP Driver::where方法代码示例

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


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

示例1: edit_help

 public function edit_help($user)
 {
     switch ($user->type) {
         case 'customer':
             Customer::where('id', '=', $user->id)->delete();
             break;
         case 'driver':
             Driver::where('id', '=', $user->id)->delete();
             break;
         case 'business':
             Business::where('id', '=', $user->id)->delete();
             break;
         default:
             break;
     }
     $user->type = Input::get('type');
     $user->save();
     switch (Input::get('type')) {
         case 'driver':
             $driver = new Driver();
             $driver->id = $user->id;
             $driver->first_name = Input::get('first_name');
             $driver->last_name = Input::get('last_name');
             $driver->phone = Input::get('phone');
             $driver->home_address = Input::get('address');
             $driver->credit_card = Input::get('credit_card');
             $driver->cvv = Input::get('cvv');
             $driver->expiry_date = Input::get('expiry_date');
             $driver->car_type = Input::get('car_type');
             $driver->cab_no = Input::get('cab_no');
             $driver->flag = Input::get('flag');
             $driver->rate = Input::get('rate');
             $driver->hour = Input::get('hour');
             $driver->save();
             break;
         case 'customer':
             $customer = new Customer();
             $customer->id = $user->id;
             $customer->first_name = Input::get('first_name');
             $customer->last_name = Input::get('last_name');
             $customer->phone = Input::get('phone');
             $customer->home_address = Input::get('address');
             $customer->credit_card = Input::get('credit_card');
             $customer->cvv = Input::get('cvv');
             $customer->expiry_date = Input::get('expiry_date');
             $customer->save();
             break;
         case 'business':
             $business = new Business();
             $business->id = $user->id;
             $business->business_name = Input::get('business_name');
             $business->phone = Input::get('phone');
             $business->home_address = Input::get('address');
             $business->credit_card = Input::get('credit_card');
             $business->cvv = Input::get('cvv');
             $business->expiry_date = Input::get('expiry_date');
             $business->save();
             break;
     }
 }
开发者ID:prateekchandan,项目名称:dipatchtaxicab-server,代码行数:60,代码来源:HomeController.php

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

示例3: getPayments

 public function getPayments()
 {
     $to = Input::get('to');
     $from = Input::get('from');
     if ($from == null || $to == null) {
         $today = LocationController::getTime();
         $todayFrom = $today['date'] . ' 00:00:00';
         $todayTo = $today['date'] . ' 23:59:59';
     } else {
         $todayFrom = $from . ' 00:00:00';
         $todayTo = $to . ' 23:59:59';
     }
     try {
         $results = Payment::where('created_at', '>', $todayFrom)->where('created_at', '<', $todayTo)->get()->toArray();
         if (!is_null($results)) {
             foreach ($results as $key => $payment) {
                 $driver = Driver::where('id', '=', $payment['driver_id'])->first()->toArray();
                 $currency = Currency::find($payment['currency'])->pluck('currency');
                 $results[$key]['driver_name'] = $driver['first'] . ' ' . $driver['last'];
                 $results[$key]['currency'] = $currency;
             }
         }
         $queries = DB::getQueryLog();
         $last_query = end($queries);
     } catch (Exception $ex) {
         \Log::error(__METHOD__ . ' | error :' . print_r($ex, 1));
     }
     //\Log::info(__METHOD__.print_r($results, 1));
     return json_encode($results);
 }
开发者ID:ardyaryan,项目名称:presidential-car-api,代码行数:30,代码来源:AdminController.php

示例4: get_getDriver

 public function get_getDriver()
 {
     $q = Input::get('query');
     $driver = Driver::where('driver_status', '=', 1)->where('pool_id', '=', Auth::user()->pool_id)->where('nip', 'like', '%' . $q . '%')->or_where('name', 'like', '%' . $q . '%')->get();
     $data = array();
     foreach ($driver as $k) {
         $data[] = array('id' => $k->id, 'nip' => $k->nip, 'name' => $k->name);
     }
     return json_encode($data);
 }
开发者ID:acmadi,项目名称:diantaksi,代码行数:10,代码来源:schedule.php

示例5: issueFine

 public function issueFine()
 {
     $input = Input::json();
     //latitude and longitude details
     $latitude = $input->get('latitude');
     $longitude = $input->get('longitude');
     $signature = $input->get('signature');
     if ($signature) {
         $signature_path = $this->saveimage($signature);
     }
     //fined by user
     $officer_data = $input->get('finedby');
     $finedata = $input->get('fine');
     $fines_name = $finedata['fines'];
     $info = $finedata['info'];
     $vehicle_vin = $info['vehiclevin'];
     $driver_id = $info['driver']['driver_id'];
     //GROUP ALL FINES NAME ACCORDING TO USER TYPE
     foreach ($fines_name as $names) {
         $data[$names['type']][] = $names['name']['id'];
         $fine_names[$names['type']][] = $names['name']['name'];
     }
     $today = date('mdY');
     //save vehicle and get its ID
     $sequence = VehicleTemp::orderBy('id', 'DESC')->first();
     $sequence_id = $sequence->id + 1001;
     $temp_no = "TEMP-" . $today . "-" . $sequence_id;
     $vehicletemp['vehicles_vin'] = $vehicle_vin;
     $vehicletemp['temp_registration_num'] = $temp_no;
     $vehicle = VehicleTemp::create($vehicletemp);
     $vehicle_id = $vehicle->id;
     //fine to vehicle
     $registartion_num = $vehicle->temp_registration_num;
     if (array_key_exists('vehicle', $data)) {
         $vehiclefine_ids = $data['vehicle'];
         $vehiclefine = $fine_names['vehicle'];
         //check if we have vehicle violations names
         $fine_id = $vehiclefine_ids;
         $fines_all = VehicleFine::whereIn('id', $fine_id)->get();
         $fine = VehicleFine::find($fine_id[0]);
         $sequence = ViolateVehicleTemp::orderBy('id', 'DESC')->first();
         $sequence_id = $sequence->id + 1001;
         //citation number
         $citaion_number = "TEMP-" . $fine->vehicle_violation_code . '-' . $today . '-' . $officer_data['badge_id_number'] . '-' . $sequence_id;
         //SAVE FINES FOR DRIVERS
         foreach ($fine_id as $id) {
             //echo $id;
             $fineinfo['driver_id'] = $driver_id;
             $fineinfo['temp_vehicle_id'] = $vehicle_id;
             $fineinfo['vehicle_fine_id'] = $id;
             $fineinfo['vehicle_fine_unique_id'] = $citaion_number;
             $fineinfo['officer_id'] = $officer_data['badge_id_number'];
             $fineinfo['longitude'] = $longitude;
             $fineinfo['latitude'] = $latitude;
             $fineinfo['status'] = '2';
             $saved_fine = ViolateVehicleTemp::create($fineinfo);
         }
         if ($signature) {
             //type 1 for vehicle signature type fine
             $data_signature['fine_id'] = $saved_fine->id;
             $data_signature['type'] = 'temp_1';
             $data_signature['signature'] = $signature;
             $data_signature['path'] = $signature_path;
             DB::table('signature')->insert($data_signature);
         }
         //SEND EMAIL HERE
         $title = "New traffic citation: non-registered vehicle";
         $temp_registartion_id = $vehicle->temp_registration_num;
         $amount = array_sum(VehicleFine::whereIn('id', $fine_id)->lists('vehicle_fine_ammount'));
         $drivers_email = Driver::where('id', $driver_id)->lists('drivers_email');
         $driver = Driver::where('id', $driver_id)->first()->toArray();
         $sender = array_unique($drivers_email);
         $data_array = array('registration_number' => $temp_registartion_id, 'fine_descp' => $vehiclefine, 'citation_num' => $citaion_number, 'amount' => $amount, 'driver' => $driver);
         if (array_key_exists('vehicle', $data) and array_key_exists('driver', $data)) {
             //check if both fines are issued
             $email_data_both['sender'] = $sender;
             $email_data_both['data_vehicle'] = $data_array;
             $email_data_both['sms_vehicle'] = "New traffic fine Citation#:" . $citaion_number . " Driver: " . $driver['drivers_fname'] . " " . $driver['drivers_lname'] . " Reg#:" . $temp_registartion_id . " Amount:" . $amount . " Pay fines at GRA location.";
         } else {
             $sent = Mail::send('emails.temp', $data_array, function ($message) use($title, $sender, $signature_path) {
                 $message->to($sender)->subject($title);
                 $message->attach($signature_path);
             });
             $template = "New traffic fine Citation#:" . $citaion_number . " Driver: " . $driver['drivers_fname'] . " " . $driver['drivers_lname'] . " Reg#:" . $temp_registartion_id . " Amount:" . $amount . " Pay fines at GRA location.";
             $to = $driver['drivers_isd1'] . $driver['drivers_cell1'];
             Helpers::SendSms($to, $template);
         }
         $vehicle_fine_amount = $amount;
         $printer_data_vehicle['citation_number'] = $citaion_number;
         $printer_data_vehicle['fines'] = $fines_all;
         $printer_data_vehicle['offender'] = $driver;
     }
     //fine to driver
     if (array_key_exists('driver', $data)) {
         $driverfines_id = $data['driver'];
         $fine_id = $driverfines_id;
         $fines_all = DriverFine::whereIn('id', $fine_id)->get();
         $fine = DriverFine::find($fine_id[0]);
         $sequence = ViolateDriverTemp::orderBy('id', 'DESC')->first();
         $sequence_id = $sequence->id + 1001;
//.........这里部分代码省略.........
开发者ID:abhikalotra,项目名称:Samples1,代码行数:101,代码来源:ApiController.php

示例6: post_otorisasipusat

 public function post_otorisasipusat()
 {
     $nip = Input::get('nip');
     $this->data['drivers'] = Driver::where('nip', 'LIKE', '%' . $nip . '%')->where('fg_super_blocked', '=', 1)->order_by('nip', 'asc')->paginate(20);
     return View::make('themes.modul.' . $this->views . '.otorisasipusat', $this->data);
 }
开发者ID:acmadi,项目名称:diantaksi,代码行数:6,代码来源:proses.php

示例7: replaceCar

 public function replaceCar()
 {
     $newCarId = Input::get('new_car_id');
     try {
         $userId = Session::get('user_id');
         $driver = Driver::where('user_id', '=', $userId)->firstOrFail();
         $driver->car_id = $newCarId;
         $driver->save();
         Session::set('car_id', $newCarId);
         $newCar = Cars::find($newCarId);
         $results = array('success' => true, 'message' => 'New Car assigned.', 'new_car' => $newCar);
     } catch (Exception $ex) {
         \Log::error(__METHOD__ . ' | error :' . print_r($ex, 1));
         $results = array('success' => false, 'message' => 'an error occurred');
     }
     return $results;
 }
开发者ID:ardyaryan,项目名称:presidential-car-api,代码行数:17,代码来源:DriverController.php


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