本文整理汇总了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]);