本文整理匯總了PHP中Driver::all方法的典型用法代碼示例。如果您正苦於以下問題:PHP Driver::all方法的具體用法?PHP Driver::all怎麽用?PHP Driver::all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Driver
的用法示例。
在下文中一共展示了Driver::all方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: list_ids
protected function list_ids()
{
if ($this->_list_ids === NULL) {
$this->_list_ids = (array) $this->_driver->all($this->_locator->xpath(), $this->_parent->id());
if ($this->_locator->filters()) {
foreach ($this->_list_ids as $offset => $id) {
if (!$this->_locator->is_filtered($this->_load($id), $offset)) {
unset($this->_list_ids[$offset]);
}
}
}
}
return $this->_list_ids;
}
示例2: getDrivers
public function getDrivers()
{
$results = Driver::all()->toArray();
foreach ($results as $key => $driver) {
$driverName = $driver['first'] . ' ' . $driver['last'];
$email = Users::where('id', '=', $driver['user_id'])->pluck('email');
$hours = Driver::getHoursByDriverId($driver['user_id']);
$trips = Driver::getTripsByDriverId($driver['user_id']);
$earning = Driver::getEarningsByDriverId($driver['user_id']);
$results[$key]['hours'] = $hours['hours'];
$results[$key]['trips'] = $trips['count'];
$results[$key]['earning'] = $earning['earning'];
//.' '.$earning['currency'];
$results[$key]['hour_per_trip'] = round($trips['count'] == 0 ? 0 : $hours['hours'] / $trips['count'], 2);
$results[$key]['earning_per_hour'] = round($hours['hours'] == 0 ? 0 : $earning['earning'] / $hours['hours'], 2) . ' MAD';
$results[$key]['earning_per_trip'] = round($trips['count'] == 0 ? 0 : $earning['earning'] / $trips['count'], 2) . ' MAD';
$results[$key]['name'] = $driverName;
$results[$key]['email'] = $email;
unset($results[$key]['first']);
unset($results[$key]['last']);
}
//Log::info(__METHOD__.print_r($results, 1));
return json_encode($results);
}