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


PHP Vehicle::select方法代码示例

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


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

示例1: selectByCollection

 public static function selectByCollection($id)
 {
     $connection = Flight::dbMain();
     try {
         $sql = "SELECT * FROM vehicle_collection WHERE collection_id = :collection_id;";
         $query = $connection->prepare($sql);
         $query->bindParam(':collection_id', $id, PDO::PARAM_INT);
         $query->execute();
         $rows = $query->fetchAll(PDO::FETCH_ASSOC);
         $result = array();
         foreach ($rows as $row) {
             $vehicleCollection = new VehicleCollection();
             $vehicleCollection->Id = (int) $row['id'];
             $vehicleCollection->Vehicle = Vehicle::select($row['vehicle_id']);
             $vehicleCollection->Collection = Collection::select($row['collection_id']);
             array_push($result, $vehicleCollection);
         }
         return $result;
     } catch (PDOException $pdoException) {
         throw $pdoException;
     } catch (Exception $exception) {
         throw $exception;
     } finally {
         $connection = null;
     }
 }
开发者ID:rhalf,项目名称:app_track,代码行数:26,代码来源:vehiclecollection.php

示例2: transportList

 /**
  *
  * Predefined Transport List
  *
  */
 public function transportList()
 {
     $vehicle_id = array();
     $vehicles = Vehicle::where('val', 1)->get();
     // filtering
     $vehicle = Vehicle::lists('vehicle_type', 'id');
     $city = array('76' => 'Any') + City::lists('city', 'id');
     //$city['%'] = 'Any';
     if (Session::has('st_date')) {
         $st_date = Session::get('st_date');
     } else {
         $st_date = date("Y/m/d");
     }
     if (Session::has('ed_date')) {
         $ed_date = Session::get('ed_date');
     } else {
         $ed_date = date("Y/m/d", strtotime($st_date . ' + 2 days'));
     }
     if (Input::has('vehicle')) {
         $get_vehicle = Input::get('vehicle');
         $vehicle_id[] = $get_vehicle;
     } else {
         $get_vehicle_ids = Vehicle::select('id')->get();
         foreach ($get_vehicle_ids as $get_vehicle_id) {
             $vehicle_id[] = $get_vehicle_id->id;
         }
     }
     if (Input::has('price_range_transport')) {
         $price_range_array = Input::get('price_range_transport');
         $price_range = explode(';', $price_range_array);
         $min_rate = $price_range[0];
         $max_rate = $price_range[1];
         $min_trans_rate = $min_rate;
         $max_trans_rate = $max_rate;
     } else {
         $min_rate = 0;
         $max_rate = 10000000;
         $min_trans_rate = TransportPackage::min('rate');
         $max_trans_rate = TransportPackage::max('rate');
     }
     if (Input::has('from')) {
         $from = Input::get('from');
     } else {
         $from = '%';
     }
     if (Input::has('from')) {
         $to = Input::get('to');
     } else {
         $to = '%';
     }
     // dd($from.'/'.$to);
     if (Input::has('transport_days')) {
         $days = Input::get('transport_days');
     } else {
         $days = '%';
     }
     //dd($min_rate.'/'.$max_rate);
     $transport_packages = TransportPackage::WhereHas('Vehicle', function ($r) use($vehicle_id) {
         $r->whereIn('id', $vehicle_id);
     })->where('val', 1)->where('rate', '>=', $min_rate)->where('rate', '<=', $max_rate)->where('origin', 'LIKE', $from)->where('destination', 'LIKE', $to)->where('days', 'LIKE', $days)->paginate(9);
     return View::make('transport.transport_list')->with(array('transport_packages' => $transport_packages, 'min_trans_rate' => $min_trans_rate, 'max_trans_rate' => $max_trans_rate, 'vehicle' => $vehicle, 'city' => $city, 'vehicles' => $vehicles, 'st_date' => $st_date, 'ed_date' => $ed_date));
 }
开发者ID:tharindarodrigo,项目名称:agent,代码行数:67,代码来源:TransportPackageController.php

示例3: function

Flight::route('GET /v1/main/vehicle', function () {
    $company = Flight::request()->query->company;
    try {
        if ($company) {
            $array = Vehicle::selectByCompany($company);
        } else {
            $array = Vehicle::selectAll();
        }
        Flight::ok($array);
    } catch (Exception $exception) {
        Flight::error($exception);
    }
});
Flight::route('GET /v1/main/vehicle/@id', function ($id) {
    try {
        $object = Vehicle::select($id);
        Flight::ok($object);
    } catch (Exception $exception) {
        Flight::error($exception);
    }
});
Flight::route('POST /v1/main/vehicle', function () {
    try {
        $object = Vehicle::insert();
        Flight::ok($object);
    } catch (Exception $exception) {
        Flight::error($exception);
    }
});
Flight::route('PUT /v1/main/vehicle/@id', function ($id) {
    try {
开发者ID:rhalf,项目名称:app_track,代码行数:31,代码来源:main.php


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