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


PHP Vehicle::vehicleStickerPrefix方法代码示例

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


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

示例1: sticker

 public function sticker($id)
 {
     $vehicle = Vehicle::withTrashed()->find($id);
     if (Vehicle::vehicleStickerPrefix($id)) {
         $vehicle->sticker_prefix = Vehicle::vehicleStickerPrefix($id);
     }
     $registration = $vehicle->registrationTrashed;
     $vehicle['vehicles_class_name'] = Vehicle::vehicleClassName($id);
     $owners = $vehicle->owners;
     $authorizedDr = $vehicle->authorizedDrivers;
     $documents = $vehicle->documents;
     $insurance = $vehicle->insurance;
     $lien = $vehicle->lien;
     // BEGIN SETTING VEHICLE AND REGISTRATION STATUS
     /*
      * Vehicle Status ($registration->veh_status)
      * Vehicle is new                       = 1
      * Vehicle is old and never transferred = 2
      * Vehicle has been transferred         = 3
      *     (And Not currently in use)        
      * Vehicle is old and transferred       = 4
      *     (But currently in use)
      */
     /*
      * Registration Status ($registration->reg_status)
      * Sticker Never Generated = 1
      * Sticker Expired         = 2
      */
     $vehilceHistory = Vehicle::getVehicleHistory($id);
     $vehicleHistoryCount = count($vehilceHistory);
     $registrations_last_renewal = $registration->registrations_last_renewal;
     // VEHICLE IS NEVER TRANSFERRED AND CURRENTLY IN USE
     if ($vehicleHistoryCount == 1) {
         // STICKER HAS BEEN ISSUED BEFORE
         if ($registrations_last_renewal) {
             // VEHICLE IS OLD
             $registration->veh_status = 2;
             //BEGIN CHECKING IF ROAD TAX EXPIRED
             $curYear = date("Y");
             $roadTaxYear = date("Y", strtotime($registrations_last_renewal));
             // NEED TO REGISTER
             if ($curYear > $roadTaxYear) {
                 $registration->reg_status = 2;
             }
             //END CHECKING IF ROAD TAX EXPIRED
             // STICKER REGISTRATION DATE
             $registration->sticker_reg_date = date("M dS, Y", strtotime($registrations_last_renewal));
             // STICKER EXPIRY DATE
             $registration->expiry = "Dec 31st, " . date("Y", strtotime($registrations_last_renewal));
         } else {
             $registration->veh_status = 1;
             $registration->reg_status = 1;
             // CHECK IF HAS PRE REGISTRATION FINES
             $vehicleVoilations = $vehicle->voilations;
             if ($vehicleVoilations->count()) {
                 $vehicleVoilationsIds = $vehicleVoilations->lists('vehicle_fine_id');
                 $vehicleFines = VehicleFine::find($vehicleVoilationsIds)->sum('vehicle_fine_ammount');
             } else {
                 $vehicleFines = 0;
             }
             // DRIVER VOILATIONS
             $driverViolations = $vehicle->driverViolations;
             if ($driverViolations->count()) {
                 $driverVoilationsIds = $driverViolations->lists('driver_fine_id');
                 $driverFines = DriverFine::find($driverVoilationsIds)->sum('driver_fine_ammount');
             } else {
                 $driverFines = 0;
             }
             $fines = $vehicleFines + $driverFines;
         }
     } else {
         $lastTransferredTo = end($vehilceHistory);
         // VEHICLE IS OLD, TRANSFERRED AND NOT CURRENTLY IN USE
         if ($lastTransferredTo != $id) {
             $registration->veh_status = 3;
         } else {
             $registration->veh_status = 4;
             // STICKER WAS ISSUED BEFORE
             if ($registrations_last_renewal) {
                 //BEGIN CHECKING IF ROAD TAX EXPIRED
                 $curYear = date("Y");
                 $roadTaxYear = date("Y", strtotime($registrations_last_renewal));
                 // NEED TO REGISTER
                 if ($curYear > $roadTaxYear) {
                     $registration->reg_status = 2;
                 }
                 //END CHECKING IF ROAD TAX EXPIRED
                 // STICKER REGISTRATION DATE
                 $registration->sticker_reg_date = date("M dS, Y", strtotime($registrations_last_renewal));
                 // STICKER EXPIRY DATE
                 $registration->expiry = "Dec 31st, " . date("Y", strtotime($registrations_last_renewal));
             } else {
                 $registration->reg_status = 1;
             }
         }
     }
     $data = compact('registration', 'fines', 'vehicle', 'owners', 'authorizedDr', 'documents', 'insurance', 'lien');
     return View::make('vehicle.sticker', $data);
 }
开发者ID:abhikalotra,项目名称:Samples1,代码行数:99,代码来源:controller.php


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