當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Vehicle::vehicleRegistrationSequence方法代碼示例

本文整理匯總了PHP中Vehicle::vehicleRegistrationSequence方法的典型用法代碼示例。如果您正苦於以下問題:PHP Vehicle::vehicleRegistrationSequence方法的具體用法?PHP Vehicle::vehicleRegistrationSequence怎麽用?PHP Vehicle::vehicleRegistrationSequence使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Vehicle的用法示例。


在下文中一共展示了Vehicle::vehicleRegistrationSequence方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: data


//.........這裏部分代碼省略.........
     // BEGIN AJAX REQUEST TO GENERATE REGISTRATION NO. (MODEL ALREADY IN DB)
     if (isset($_POST['inp']) && $_POST['inp'] == 8) {
         $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]);
         $model_trim = trim($vehicles_name_trim_ar[1]);
         $vehicles_body = trim(Input::get('vehicles_body'));
         $vehicles_weight_kg = trim(Input::get('vehicles_weight_kg'));
         $new_wt = (int) Input::get('new_wt');
         $vehicles_year = trim(Input::get('vehicles_year'));
         $vehicles_use_type = Input::get('vehicles_use_type');
         $vehicles_class = Input::get('vehicles_class');
         $vehicles_class_abbr = trim(Input::get('vehicles_class_abbr'));
         // IF DEFAULT WEIGHT IS PRESENT
         if ($new_wt) {
             // IF MODEL HAS BODY
             if ($vehicles_body) {
                 $model = Model::where('model_make_id', $vehicles_make_id)->where('model_name', $model_name)->where('model_trim', $model_trim)->where('model_body', $vehicles_body)->whereNull('model_weight_kg')->first();
             } else {
                 $model = Model::where('model_make_id', $vehicles_make_id)->where('model_name', $model_name)->where('model_trim', $model_trim)->whereNull('model_body')->whereNull('model_weight_kg')->first();
             }
         } else {
             // IF MODEL HAS BODY
             if ($vehicles_body) {
                 $model = Model::where('model_make_id', $vehicles_make_id)->where('model_name', $model_name)->where('model_trim', $model_trim)->where('model_body', $vehicles_body)->where('model_weight_kg', $vehicles_weight_kg)->first();
             } else {
                 $model = Model::where('model_make_id', $vehicles_make_id)->where('model_name', $model_name)->where('model_trim', $model_trim)->whereNull('model_body')->where('model_weight_kg', $vehicles_weight_kg)->first();
             }
         }
         $model_year = $model->model_year;
         $model_make_id = strtoupper(substr($model->model_make_id, 0, 4));
         $year = date("Y");
         $class_sequence = Vehicle::vehicleRegistrationSequence($vehicles_use_type, $vehicles_class);
         //$class_sequence =  str_pad(Vehicle::withTrashed()->where('vehicles_use_type', $vehicles_use_type)->where('vehicles_class', $vehicles_class)->count()+1, 7, 0, STR_PAD_LEFT);
         return $vehicles_class_abbr . "-" . $year . "-" . $model_year . "-" . $model_make_id . "-" . $class_sequence;
     }
     // END AJAX REQUEST TO GENERATE REGISTRATION NO. (MODEL ALREADY IN DB)
     // BEGIN AJAX REQUEST TO GENERATE REGISTRATION NO. (NEW MODEL)
     if (isset($_POST['inp']) && $_POST['inp'] == 9) {
         $vehicles_make_id = strtoupper(substr(trim(Input::get('vehicles_make_id')), 0, 4));
         $vehicles_year = trim(Input::get('vehicles_year'));
         $vehicles_use_type = Input::get('vehicles_use_type');
         $vehicles_class = Input::get('vehicles_class');
         $vehicles_class_abbr = trim(Input::get('vehicles_class_abbr'));
         $year = date("Y");
         $class_sequence = Vehicle::vehicleRegistrationSequence($vehicles_use_type, $vehicles_class);
         //$class_sequence =  str_pad(Vehicle::withTrashed()->where('vehicles_use_type', $vehicles_use_type)->where('vehicles_class', $vehicles_class)->count()+1, 7, 0, STR_PAD_LEFT);
         return $registration_number = $vehicles_class_abbr . "-" . $year . "-" . $vehicles_year . "-" . $vehicles_make_id . "-" . $class_sequence;
     }
     // END AJAX REQUEST TO GENERATE REGISTRATION NO. (NEW MODEL)
     // BEGIN AJAX REQUEST TO SHOW VEHICLE SEARCHED BY USING REGISTRATION NO. (vehicle.search, vehicle.search-by-reg)
     if (isset($_POST['registrations_no']) && $_POST['registrations_no'] != "") {
         $registrations_no = $_POST['registrations_no'];
         $vehicles_id_count = Registration::withTrashed()->where('registrations_no', $registrations_no)->count();
         if ($vehicles_id_count != 0) {
             $vehicles_id = Registration::withTrashed()->where('registrations_no', $registrations_no)->first()->registrations_vehicle_id;
             $vehicles = Vehicle::withTrashed()->find($vehicles_id);
             $vehicles_vin = $vehicles->vehicles_vin;
             $vehicles_model_id = $vehicles->vehicles_model_id;
             $vehicles_use_type_id = $vehicles->vehicles_use_type;
             $model = Model::find($vehicles_model_id);
             $model_make_id = $model->model_make_id;
             $model_name = $model->model_name;
             $vehicle_use_types_name = VehicleUseType::find($vehicles_use_type_id)->vehicle_use_types_name;
             $url = URL::route('vehicle.edit', [$vehicles_id]);
開發者ID:abhikalotra,項目名稱:Samples1,代碼行數:67,代碼來源:controller.php


注:本文中的Vehicle::vehicleRegistrationSequence方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。