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


PHP Company::select方法代码示例

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


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

示例1: select

 public static function select($id)
 {
     $connection = Flight::dbMain();
     try {
         $sql = "SELECT * FROM geofence WHERE id = :id;";
         $query = $connection->prepare($sql);
         $query->bindParam(':id', $id, PDO::PARAM_INT);
         $query->execute();
         if ($query->rowCount() < 1) {
             return null;
         }
         $row = $query->fetch(PDO::FETCH_ASSOC);
         $geofence = new Geofence();
         $geofence->Id = (int) $row['id'];
         $geofence->Company = Company::select($row['company_id']);
         $geofence->Name = $row['geofence_name'];
         $geofence->Desc = $row['geofence_desc'];
         $geofence->Coordinates = $row['geofence_coordinates'];
         $geofence->Type = (int) $row['geofence_type'];
         $geofence->SpeedMinL = (int) $row['geofence_speed_min_l'];
         $geofence->SpeedMaxL = (int) $row['geofence_speed_max_l'];
         $geofence->SpeedMinH = (int) $row['geofence_speed_min_h'];
         $geofence->SpeedMaxH = (int) $row['geofence_speed_max_h'];
         $geofence->IsGlobal = (int) $row['geofence_is_global'];
         $geofence->IsVisible = (int) $row['geofence_is_visible'];
         return $geofence;
     } catch (PDOException $pdoException) {
         throw $pdoException;
     } catch (Exception $exception) {
         throw $exception;
     } finally {
         $connection = null;
     }
 }
开发者ID:rhalf,项目名称:app_track,代码行数:34,代码来源:geofence.php

示例2: select

 public static function select($id)
 {
     $connection = Flight::dbMain();
     try {
         $sql = "SELECT * FROM route WHERE id = :id;";
         $query = $connection->prepare($sql);
         $query->bindParam(':id', $id, PDO::PARAM_INT);
         $query->execute();
         if ($query->rowCount() < 1) {
             return null;
         }
         $row = $query->fetch(PDO::FETCH_ASSOC);
         $route = new Route();
         $route->Id = (int) $row['id'];
         $route->Name = $row['route_name'];
         $route->Desc = $row['route_description'];
         $route->Coordinates = $row['route_coordinates'];
         $route->IsVisible = (bool) $row['route_is_visible'];
         $route->IsGlobal = (bool) $row['route_is_global'];
         $route->Company = Company::select($row['company_id']);
         return $route;
     } catch (PDOException $pdoException) {
         throw $pdoException;
     } catch (Exception $exception) {
         throw $exception;
     } finally {
         $connection = null;
     }
 }
开发者ID:rhalf,项目名称:app_track,代码行数:29,代码来源:route.php

示例3: index

 /**
  * [index - This is for the typeahead lookups, restfull routes are configured in routes.php (/api/v1/)]
  * @return [json] [DT compatible object]
  */
 public function index()
 {
     if (Input::get('q')) {
         $datums = Company::select('bedrijfsnaam AS value', 'id')->where('bedrijfsnaam', 'like', '%' . Input::get('q') . '%')->take(50)->get();
         foreach ($datums as $datum) {
             $datum->tokens = explode(' ', $datum->value);
         }
         return Response::json($datums);
     } else {
         return Response::json(Company::select('bedrijfsnaam AS value', 'id')->orderBy('updated_at', 'DESC')->take(50)->get());
     }
 }
开发者ID:strikles,项目名称:php,代码行数:16,代码来源:AdminCompanyController.php

示例4: getCompanyResults

 public function getCompanyResults()
 {
     $company = array();
     $company['name'] = Input::get('name');
     $company['country'] = Input::get('country');
     $company['city'] = Input::get('city');
     $company['references'] = Input::get('references');
     $company_results = Company::select('companies.*', 'c.name as country', 'a.city AS city')->join('adresses AS a', 'companies.address_id', '=', 'a.id')->join('countries AS c', 'a.country_id', '=', 'c.id');
     if (empty(Input::get('name')) && empty(Input::get('country')) && empty(Input::get('city')) && empty(Input::get('references'))) {
         $company_results->orderBy('companies.id', 'DESC')->take(5);
     } else {
         if (!empty(Input::get('name'))) {
             $company_results->where('companies.name', 'LIKE', '%' . $company['name'] . '%');
         }
         if (!empty(Input::get('references'))) {
             $company_results->where('companies.references', 'LIKE', '%' . $company['references'] . '%');
         }
         if (!empty(Input::get('city'))) {
             $city_search_terms = explode(',', Input::get('city'));
             $city_where_str = "";
             for ($city_ndx = 0; $city_ndx < count($city_search_terms); $city_ndx++) {
                 if ($city_ndx !== 0) {
                     $city_where_str .= " OR a.city LIKE '%" . $city_search_terms[$city_ndx] . "%' ";
                 } else {
                     $city_where_str .= " a.city LIKE '%" . $city_search_terms[$city_ndx] . "%' ";
                 }
             }
             $company_results->whereRaw("(" . $city_where_str . ")");
         }
         if (!empty(Input::get('country'))) {
             $country_search_terms = explode(',', Input::get('country'));
             $country_where_str = "";
             for ($country_ndx = 0; $country_ndx < count($country_search_terms); $country_ndx++) {
                 if ($country_ndx !== 0) {
                     $country_where_str .= " OR c.name LIKE '%" . $country_search_terms[$country_ndx] . "%' ";
                 } else {
                     $country_where_str .= " c.name LIKE '%" . $country_search_terms[$country_ndx] . "%' ";
                 }
             }
             $company_results->whereRaw("(" . $country_where_str . ")");
         }
     }
     $company_results = $company_results->get();
     $data = [];
     foreach ($company_results as $curr_company) {
         $curr_company = (object) ['DT_RowId' => $curr_company->id, 'name' => $curr_company->name, 'references' => $curr_company->references, 'country' => $curr_company->country, 'city' => $curr_company->city];
         $curr_entry = (object) $curr_company;
         $data[] = $curr_entry;
     }
     echo json_encode(['data' => $data]);
 }
开发者ID:strikles,项目名称:php,代码行数:51,代码来源:SearchController.php

示例5: login

 public static function login()
 {
     $connection = Flight::dbMain();
     try {
         $session = json_decode(file_get_contents("php://input"));
         if ($session == null) {
             throw new Exception(json_get_error());
         }
         $sql = "SELECT * FROM user WHERE user.user_name = :name and user.user_password = :password;";
         $query = $connection->prepare($sql);
         $password = hash('sha256', $session->Password);
         $query->bindParam(':name', $session->Name, PDO::PARAM_STR);
         $query->bindParam(':password', $password, PDO::PARAM_STR);
         $query->execute();
         $row = $query->fetch(PDO::FETCH_ASSOC);
         if ($query->rowCount() < 1) {
             throw new Exception("Username or Password is not exist");
         }
         $user = new User();
         $user->Id = (int) $row['id'];
         $user->Name = $row['user_name'];
         $user->DtCreated = $row['user_dt_created'];
         $user->DtExpired = $row['user_dt_expired'];
         // $user->Privilege = (int) $row['e_privilege_id'];
         // $user->Status = (int) $row['e_status_id'];
         // $user->Company = (int) $row['company_id'];
         // $user->Sim = $row['sim_id'] == null ? null : (int) $row['sim_id'];
         $user->Privilege = Privilege::select($row['e_privilege_id']);
         $user->Status = Status::select($row['e_status_id']);
         $user->Company = Company::select($row['company_id']);
         $user->Sim = Sim::select($row['sim_id']);
         Flight::ok($user);
     } catch (PDOException $pdoException) {
         Flight::error($pdoException);
     } catch (Exception $exception) {
         Flight::error($exception);
     } finally {
         $connection = null;
     }
 }
开发者ID:rhalf,项目名称:app_track,代码行数:40,代码来源:session.php

示例6: delete

 public static function delete($id)
 {
     $connection = Flight::dbMain();
     try {
         /* Begin Transaction */
         $connection->beginTransaction();
         /*Query 1 Select unit*/
         $sql = "SELECT * FROM unit WHERE id = :id;";
         $query = $connection->prepare($sql);
         $query->bindParam(':id', $id, PDO::PARAM_INT);
         $query->execute();
         $rows = $query->fetchAll(PDO::FETCH_ASSOC);
         $row = $rows[0];
         $unit = new Unit();
         $unit->Id = (int) $row['id'];
         $unit->Imei = $row['unit_imei'];
         $unit->DtCreated = $row['unit_dt_created'];
         $unit->SerialNumber = $row['unit_serial_number'];
         $unit->Sim = Sim::select($row['sim_id']);
         $unit->UnitStatus = UnitStatus::select($row['e_status_unit_id']);
         $unit->UnitType = UnitType::select($row['unit_type_id']);
         $unit->Company = Company::select($row['company_id']);
         /*Query 2 Delete unit*/
         $sql = "\n\t\t\tDELETE FROM unit \n\t\t\tWHERE\n\t\t\tid = :id";
         $query = $connection->prepare($sql);
         $query->bindParam(':id', $id, PDO::PARAM_INT);
         $query->execute();
         /*Query 3 Drop data_unit.imei table*/
         $year = date('Y');
         $schema = "app_data_{$year}";
         $imei = $unit->Imei;
         $tableName = "data_{$imei}";
         $sql = "\n\t\t\t\n\t\t\tDROP TABLE IF EXISTS {$schema}.{$tableName};\n\n\t\t\t";
         $query = $connection->prepare($sql);
         $query->execute();
         $connection->commit();
         $result = new Result();
         $result->Status = Result::DELETED;
         $result->Message = 'Done';
         $result->Id = $id;
         return $result;
     } catch (PDOException $pdoException) {
         $connection->rollBack();
         throw $pdoException;
     } catch (Exception $exception) {
         $connection->rollBack();
         throw $exception;
     } finally {
         $connection = null;
     }
 }
开发者ID:rhalf,项目名称:app_track,代码行数:51,代码来源:unit.php

示例7: selectByCompany

 public static function selectByCompany($id)
 {
     $connection = Flight::dbMain();
     try {
         $sql = "SELECT * FROM driver WHERE company_id = :company;";
         $query = $connection->prepare($sql);
         $query->bindParam(':company', $id, PDO::PARAM_INT);
         $query->execute();
         $rows = $query->fetchAll(PDO::FETCH_ASSOC);
         $result = array();
         foreach ($rows as $row) {
             $driver = new Driver();
             $driver->Id = (int) $row['id'];
             $driver->DriverId = $row['driver_id'];
             $driver->Name = $row['driver_name'];
             $driver->NameFirst = $row['driver_name_f'];
             $driver->NameMiddle = $row['driver_name_m'];
             $driver->NameLast = $row['driver_name_l'];
             $driver->Rfid = $row['driver_rfid'];
             $driver->DtCreated = $row['driver_dt_created'];
             $driver->Status = Status::select($row['e_status_id']);
             $driver->Company = Company::select($row['company_id']);
             array_push($result, $driver);
         }
         return $result;
     } catch (PDOException $pdoException) {
         throw $pdoException;
     } catch (Exception $exception) {
         throw $exception;
     } finally {
         $connection = null;
     }
 }
开发者ID:rhalf,项目名称:app_track,代码行数:33,代码来源:driver.php

示例8: selectByCompany

 public static function selectByCompany($id)
 {
     $connection = Flight::dbMain();
     try {
         $sql = "SELECT * FROM company_info WHERE company_id = :company_id LIMIT 1;";
         $query = $connection->prepare($sql);
         $query->bindParam(':company_id', $id, PDO::PARAM_INT);
         $query->execute();
         if ($query->rowCount() < 1) {
             return null;
         }
         $row = $query->fetch(PDO::FETCH_ASSOC);
         $companyInfo = new CompanyInfo();
         $companyInfo->Id = (int) $row['id'];
         $companyInfo->Logo = $row['info_logo'];
         $companyInfo->Alert = (int) $row['info_alert'];
         $companyInfo->Notify = (int) $row['info_noti'];
         $companyInfo->Theme = (int) $row['info_theme'];
         $companyInfo->Field = Field::select($row['e_field_id']);
         $companyInfo->Company = Company::select($row['company_id']);
         return $companyInfo;
     } catch (PDOException $pdoException) {
         throw $pdoException;
     } catch (Exception $exception) {
         throw $exception;
     } finally {
         $connection = null;
     }
 }
开发者ID:rhalf,项目名称:app_track,代码行数:29,代码来源:companyinfo.php

示例9: selectByCompany

 public static function selectByCompany($id)
 {
     $connection = Flight::dbMain();
     try {
         $sql = "SELECT * FROM user WHERE company_id = :company;";
         $query = $connection->prepare($sql);
         $query->bindParam(':company', $id, PDO::PARAM_INT);
         $query->execute();
         $rows = $query->fetchAll(PDO::FETCH_ASSOC);
         $result = array();
         foreach ($rows as $row) {
             $user = new User();
             $user->Id = (int) $row['id'];
             $user->Name = $row['user_name'];
             $user->DtCreated = $row['user_dt_created'];
             $user->DtExpired = $row['user_dt_expired'];
             // $user->Privilege = (int) $row['e_privilege_id'];
             // $user->Status = (int) $row['e_status_id'];
             // $user->Company = (int) $row['company_id'];
             // $user->Sim = $row['sim_id'] == null ? null : (int) $row['sim_id'];
             $user->Privilege = Privilege::select($row['e_privilege_id']);
             $user->Status = Status::select($row['e_status_id']);
             $user->Company = Company::select($row['company_id']);
             $user->Sim = Sim::select($row['sim_id']);
             array_push($result, $user);
         }
         return $result;
     } catch (PDOException $pdoException) {
         throw $pdoException;
     } catch (Exception $exception) {
         throw $exception;
     } finally {
         $connection = null;
     }
 }
开发者ID:rhalf,项目名称:app_track,代码行数:35,代码来源:user.php

示例10: selectByCompany

 public static function selectByCompany($id)
 {
     $connection = Flight::dbMain();
     try {
         $sql = "SELECT * FROM collection WHERE company_id = :company;";
         $query = $connection->prepare($sql);
         $query->bindParam(':company', $id, PDO::PARAM_INT);
         $query->execute();
         $rows = $query->fetchAll(PDO::FETCH_ASSOC);
         $result = array();
         foreach ($rows as $row) {
             $collection = new Collection();
             $collection->Id = (int) $row['id'];
             $collection->Name = $row['collection_name'];
             $collection->Desc = $row['collection_desc'];
             // $collection->User = $row['user_id'] == null ? null : (int)$row['user_id'];
             // $collection->Company = (int)$row['company_id'];
             $collection->User = User::select($row['user_id']);
             $collection->Company = Company::select($row['company_id']);
             // $vehicleCollections = VehicleCollection::selectByCollection($collection->Id);
             // foreach ($vehicleCollections as $vehicleCollection) {
             // 	array_push($collection->Vehicles, $vehicleCollection->Vehicle);
             // }
             array_push($result, $collection);
         }
         return $result;
     } catch (PDOException $pdoException) {
         throw $pdoException;
     } catch (Exception $exception) {
         throw $exception;
     } finally {
         $connection = null;
     }
 }
开发者ID:rhalf,项目名称:app_track,代码行数:34,代码来源:collection.php

示例11: array

     $data = array();
     $results = Company::select('company_name')->where('status', '=', '2')->where('company_name', 'LIKE', '%' . $query . '%')->get();
     if (count($results) > 0) {
         foreach ($results as $row) {
             $data[] = strtolower($row->company_name) . "";
         }
     } else {
         $data[] = 'No record found.';
     }
     return Response::json($data);
 });
 Route::get('company/{id}/information/{query}', function ($id, $query) {
     // $data = array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
     //    return Response::json($data);
     $data = array();
     $results = Company::select('company_name')->where('status', '=', '2')->where('company_name', 'LIKE', '%' . $query . '%')->get();
     if (count($results) > 0) {
         foreach ($results as $row) {
             $data[] = strtolower($row->company_name) . "";
         }
     } else {
         $data[] = 'No record found.';
     }
     return Response::json($data);
 });
 Route::get('company/details/{id}', array('as' => 'company.dt', 'uses' => 'CompanyController@details'));
 Route::get('ra-company', array('as' => 'company.ra', 'uses' => 'CompanyController@ra'));
 Route::put('company/approve/{id}', array('as' => 'company.a', 'uses' => 'CompanyController@a'));
 Route::put('company/denied/{id}', array('as' => 'company.d', 'uses' => 'CompanyController@d'));
 Route::get('ra-company/details/{id}', array('as' => 'ra.company.dt', 'uses' => 'CompanyController@ra_details'));
 Route::resource('project', 'ProjectController');
开发者ID:jcyanga28,项目名称:project-reference,代码行数:31,代码来源:routes.php

示例12: selectByCompany

 public static function selectByCompany($id)
 {
     $connection = Flight::dbMain();
     try {
         $sql = "SELECT * FROM sim WHERE company_id = :company;";
         $query = $connection->prepare($sql);
         $query->bindParam(':company', $id, PDO::PARAM_INT);
         $query->execute();
         $rows = $query->fetchAll(PDO::FETCH_ASSOC);
         $result = array();
         foreach ($rows as $row) {
             $sim = new Sim();
             $sim->Id = (int) $row['id'];
             $sim->Imei = $row['sim_imei'];
             $sim->Number = $row['sim_number'];
             $sim->Roaming = (bool) $row['sim_roaming'];
             $sim->SimVendor = SimVendor::select($row['e_sim_vendor_id']);
             $sim->DtCreated = $row['sim_dt_created'];
             $sim->Status = Status::select($row['e_status_id']);
             $sim->Company = Company::select($row['company_id']);
             array_push($result, $sim);
         }
         return $result;
     } catch (PDOException $pdoException) {
         throw $pdoException;
     } catch (Exception $exception) {
         throw $exception;
     } finally {
         $connection = null;
     }
 }
开发者ID:rhalf,项目名称:app_track,代码行数:31,代码来源:sim.php

示例13: function

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

示例14: selectByCompany

 public static function selectByCompany($id)
 {
     $connection = Flight::dbMain();
     try {
         $sql = "SELECT * FROM poi WHERE company_id = :company_id;";
         $query->bindParam(':company_id', $id, PDO::PARAM_INT);
         $query = $connection->prepare($sql);
         $query->execute();
         $rows = $query->fetchAll(PDO::FETCH_ASSOC);
         $result = array();
         foreach ($rows as $row) {
             $poi = new Poi();
             $poi->Id = (int) $row['id'];
             $poi->Company = Company::select($row['company_id']);
             $poi->Name = $row['poi_name'];
             $poi->Desc = $row['poi_desc'];
             $poi->Coordinate = new Coordinate($row['poi_latitude'], $row['poi_longitude']);
             $poi->IsVisible = (bool) $row['poi_is_visible'];
             $poi->IsGlobal = (bool) $row['poi_is_global'];
             $poi->Image = $row['poi_image'];
             array_push($result, $poi);
         }
         return $result;
     } catch (PDOException $pdoException) {
         throw $pdoException;
     } catch (Exception $exception) {
         throw $exception;
     } finally {
         $connection = null;
     }
 }
开发者ID:rhalf,项目名称:app_track,代码行数:31,代码来源:poi.php

示例15: selectByCompany

 public static function selectByCompany($id)
 {
     $connection = Flight::dbMain();
     try {
         $sql = "SELECT * FROM vehicle WHERE company_id = :company;";
         $query = $connection->prepare($sql);
         $query->bindParam(':company', $id, PDO::PARAM_INT);
         $query->execute();
         $rows = $query->fetchAll(PDO::FETCH_ASSOC);
         $result = array();
         foreach ($rows as $row) {
             $vehicle = new Vehicle();
             $vehicle->Id = (int) $row['id'];
             $vehicle->DtCreated = $row['vehicle_dt_created'];
             $vehicle->DtSubscribed = $row['vehicle_dt_subscribed'];
             $vehicle->Plate = $row['vehicle_plate'];
             $vehicle->Name = $row['vehicle_name'];
             $vehicle->Model = $row['vehicle_model'];
             $vehicle->MaInitial = (int) $row['vehicle_ma_initial'];
             $vehicle->MaLimit = (int) $row['vehicle_ma_limit'];
             $vehicle->MaMaintenance = (int) $row['vehicle_ma_maintenance'];
             $vehicle->SpeedMax = (int) $row['vehicle_speed_max'];
             $vehicle->FuelMax = (int) $row['vehicle_fuel_max'];
             // $vehicle->Status = (int)$row['e_status_id'];
             // $vehicle->Driver =  $row['driver_id'] == null ? null : (int)$row['driver_id'];
             // $vehicle->Unit = $row['unit_id'] == null ? null : (int)$row['unit_id'];
             // $vehicle->Company = (int) $row['company_id'];
             // $vehicle->TrackeeType = (int) $row['e_trackee_type_id'];
             $vehicle->Status = (int) $row['e_status_id'];
             $vehicle->Driver = Driver::select($row['driver_id']);
             $vehicle->Unit = Unit::select($row['unit_id']);
             $vehicle->Company = Company::select($row['company_id']);
             $vehicle->TrackeeType = TrackeeType::select($row['e_trackee_type_id']);
             $vehicle->Status = Status::select($row['e_status_id']);
             array_push($result, $vehicle);
         }
         return $result;
     } catch (PDOException $pdoException) {
         throw $pdoException;
     } catch (Exception $exception) {
         throw $exception;
     } finally {
         $connection = null;
     }
 }
开发者ID:rhalf,项目名称:app_track,代码行数:45,代码来源:vehicle.php


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