本文整理汇总了PHP中Service::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Service::orderBy方法的具体用法?PHP Service::orderBy怎么用?PHP Service::orderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Service
的用法示例。
在下文中一共展示了Service::orderBy方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: packages
public function packages()
{
$this->data['cycles'] = Cycle::all();
$this->data['services'] = Service::orderBy('name')->get();
$this->data['packages'] = Package::paginate(25);
return $this->layout->content = View::make('packages', $this->data);
}
示例2: getAllServices
public function getAllServices()
{
// services
$all_services = Service::orderBy('name', 'ASC')->get(['id', 'name']);
$services = [];
foreach ($all_services as $service) {
$services[] = (object) ['value' => $service->id, 'label' => utf8_encode($service->name)];
}
return $services;
}
示例3: initialLoad
public function initialLoad()
{
$advertisings = Advertising::orderBy('order', 'asc')->get();
$budgets = Budget::orderBy('order', 'asc')->get();
$doctors = Doctor::with('speciality')->get();
$nav_menus = NavigationMenu::orderBy('order', 'asc')->get();
$promos = Promo::all();
$services = Service::orderBy('order', 'asc')->get();
$slider_images = SliderImage::all();
$specialities = Speciality::all();
return View::make('layouts.main', array('advertisings' => $advertisings, 'budgets' => $budgets, 'doctors' => $doctors, 'nav_menus' => $nav_menus, 'promos' => $promos, 'services' => $services, 'slider_images' => $slider_images, 'specialities' => $specialities));
}
示例4: getArea
public function getArea()
{
$roles = Role::all();
$services = Service::orderBy('action')->get();
$services = $services->toArray();
$groupedServices = [];
foreach ($services as $service) {
$actions = preg_split('/@/', $service['action']);
if (count($actions) >= 2) {
$groupedServices[$actions[0]][] = ['id' => $service['id'], 'libelle' => $actions[1]];
}
}
$result = [];
foreach ($roles as $role) {
$result[] = ['libelle' => $role->libelle, 'id' => $role->id, 'choices' => $groupedServices];
}
return $result;
}
示例5: getData
/**
* [getData - datatables response]
* @return [json] [DT compatible object]
*/
public function getData()
{
$Model = $this->modelName;
$num_skip = 0;
$num_items = 10;
$recordsTotal = 0;
$recordsFiltered = 0;
// check get vars
if (isset($_GET['start'])) {
$num_skip = (int) $_GET['start'];
}
if (isset($_GET['length'])) {
$num_items = (int) $_GET['length'];
}
if (isset($_GET['search'])) {
$search_value = $_GET['search']['value'];
}
$all_services = Service::orderBy('id', 'DESC');
if (!empty($search_value)) {
$all_services->whereRaw("(services.name LIKE '%" . $search_value . "%')");
}
$recordsTotal = $all_services->count();
$recordsFiltered = $recordsTotal;
if ($num_skip > 0) {
$all_services->skip($num_skip);
}
$all_services = $all_services->orderBy('id', 'DESC')->take($num_items)->get();
$data = [];
foreach ($all_services as $service) {
// load cat relation
$load_curr_category = $service->category;
$load_curr_status = $service->status;
$load_curr_period = $service->period;
//Debugbar::info($service);
$curr_category = $service->category !== NULL ? (object) ['id' => $service->category->id, 'name' => utf8_encode($service->category->name)] : (object) null;
$curr_status = $service->status !== NULL ? (object) ['id' => $service->status_id, 'description' => utf8_encode($service->status->description)] : (object) null;
$curr_period = $service->period !== NULL ? (object) ['id' => $service->invoice_periods_id, 'description' => utf8_encode($service->period->description)] : (object) null;
$data[] = (object) ['DT_RowId' => 'row_' . $service->id, 'service_categories' => $curr_category, 'services' => $service, 'statuses' => $curr_status, 'invoice_periods' => $curr_period];
}
$ret = ['recordsTotal' => $recordsTotal, 'recordsFiltered' => $recordsFiltered, 'data' => $data, 'service_categories' => $this->getAllServiceCategories(), 'statuses' => $this->getAllStatuses(), 'invoice_periods' => $this->getAllInvoicePeriods()];
return Response::json($ret);
}
示例6: index
/**
* Display a listing of the resource.
* GET /services
*
* @return Response
*/
public function index()
{
$services = Service::orderBy('service')->get();
return View::make('services.index')->withServices($services);
}
示例7: services
public function services()
{
$this->data['services'] = Service::orderBy('name')->paginate(10);
return $this->layout->content = View::make('services', $this->data);
}