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


PHP Department::orderBy方法代码示例

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


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

示例1: index

 public function index()
 {
     //
     $title = "Departments";
     $data = Department::orderBy('id', 'desc')->get();
     return view('html.department.list', compact('data', 'title'));
 }
开发者ID:trongtri0705,项目名称:elinext_project,代码行数:7,代码来源:DepartmentController.php

示例2: getRegister

 /**
  * Show the application registration form.
  *
  * @return \Illuminate\Http\Response
  */
 public function getRegister()
 {
     $departmentList = Department::orderBy('created_at')->get();
     $deptSelectValues = [];
     foreach ($departmentList as $dept) {
         $deptSelectValues[$dept['id']] = $dept['dept_name'];
     }
     return view('auth.register')->with(compact('deptSelectValues'));
 }
开发者ID:visualplus,项目名称:bootstrap,代码行数:14,代码来源:AuthController.php

示例3: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //::orderBy('orderByColumn')->
     $departments = Department::orderBy('name')->get();
     foreach ($departments as $dept) {
         $fac = Faculty::where('id', '=', $dept->faculty_id)->firstOrFail();
         $dept['faculty_name'] = $fac->name;
     }
     return view('department.index', compact('departments'));
 }
开发者ID:omoprodigi,项目名称:Keyword-Matching-Exam,代码行数:15,代码来源:DepartmentController.php

示例4: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     if ($id == 1) {
         Flash::error('Il est interdit de modifier ce département.');
         return Redirect::back();
     }
     $departments = Department::orderBy('name')->paginate(20);
     $depToEdit = Department::where('id', $id)->first();
     return view('admin.departments.edit', compact('departments', 'depToEdit'));
 }
开发者ID:Techraav,项目名称:PolyMusic,代码行数:16,代码来源:DepartmentController.php

示例5: filter

 public function filter()
 {
     $city_id = Input::get('city');
     $departments = Department::orderBy('city_id')->get();
     if (isset($city_id)) {
         if ($city_id == 0) {
             $departments = Department::orderBy('city_id')->get();
         } else {
             $departments = Department::where('city_id', $city_id)->get();
         }
     }
     return View::make('department.all', ['category' => 1, 'departments' => $departments, 'selectedCity' => $city_id]);
 }
开发者ID:yaroslavmelnichuk,项目名称:LarkaKursova,代码行数:13,代码来源:DepartmentsController.php

示例6: index

 public function index(Request $request)
 {
     if ($request->bp) {
         $currentBp = BusinessPlan::find($request->bp);
     } else {
         $currentBp = BusinessPlan::where('start', '<=', Carbon::now())->where('end', '>=', Carbon::now())->first();
         if (!$currentBp) {
             $currentBp = BusinessPlan::all()->last();
         }
     }
     $sorted = Goat::where('bid', $currentBp->id)->where('type', 'G')->orderBy('goal_type')->orderBy('description')->get();
     $bp = Goat::where('bid', $currentBp->id)->where('type', '<>', 'G')->orderByRaw("FIELD(type, 'O', 'A', 'T')")->orderBy('description', 'desc')->get();
     foreach ($bp as $goat) {
         if ($goat->type === 'G') {
             $sorted->push($goat);
             continue;
         }
         for ($i = 0, $len = $sorted->count(); $i < $len; $i++) {
             if ($sorted[$i]->id == $goat->parent_id) {
                 // Hacky fix since when you splice $goat into $sorted,
                 // it converts the $goat into an array instead of
                 // keeping it as a Model object...
                 $sorted->splice($i + 1, 0, "temp");
                 $sorted->put($i + 1, $goat);
                 break;
             }
         }
     }
     $leadOf = array();
     if (Auth::user()) {
         foreach (Auth::user()->leadOf as $dept) {
             array_push($leadOf, $dept->id);
         }
     }
     $collaboratorGoals = array();
     foreach ($leadOf as $dept_id) {
         foreach (Department::find($dept_id)->collaboratorOn as $goat) {
             array_push($collaboratorGoals, $goat->id);
         }
     }
     return view('view_plan')->with(['bp' => $sorted, 'users' => User::orderBy('first_name')->get(), 'depts' => Department::orderBy('name')->get(), 'leadOf' => $leadOf, 'plans' => BusinessPlan::orderBy('id', 'desc')->get(), 'query' => $request, 'bp_id' => $currentBp->id, 'is_bplead' => Auth::user() && Auth::user()->is_bplead, 'collaboratorGoals' => $collaboratorGoals]);
 }
开发者ID:macewanCS,项目名称:DreamSolutions,代码行数:42,代码来源:ViewPlanController.php

示例7: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $this->AuthorizeAndRedirect('admin');
     $departments = Department::orderBy('name')->lists('name', 'id');
     $student = User::findOrFail($id);
     return view('student.edit', compact('student', 'departments'));
 }
开发者ID:omoprodigi,项目名称:Keyword-Matching-Exam,代码行数:13,代码来源:StudentController.php

示例8: boot

 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     if (\Schema::hasTable('positions')) {
         $positions = Position::orderBy('name', 'ASC')->get();
         $selectPositions = array();
         $selectPositions[0] = "Select / All";
         foreach ($positions as $position) {
             $selectPositions[$position->slug] = $position->name;
         }
         \View::share('selectPositions', $selectPositions);
     }
     if (\Schema::hasTable('departments')) {
         $departments = Department::orderBy('name', 'ASC')->get();
         $selectDepartments = array();
         $selectDepartments[0] = "Select / All";
         foreach ($departments as $department) {
             $selectDepartments[$department->slug] = $department->name;
         }
         \View::share('selectDepartments', $selectDepartments);
     }
     if (\Schema::hasTable('provinces')) {
         $provinces = Province::all();
         $selectProvinces = array();
         $selectProvinces[0] = "Select / All";
         foreach ($provinces as $Province) {
             $selectProvinces[$Province->slug] = $Province->name;
         }
         \View::share('selectProvinces', $selectProvinces);
     }
     if (\Schema::hasTable('districts')) {
         $districts = District::all();
         $selectDistrict = array();
         $selectDistricts[0] = "Select / All";
         foreach ($districts as $district) {
             $selectDistricts[$district->slug] = $district->name;
         }
         \View::share('selectDistricts', $selectDistricts);
     }
     if (\Schema::hasTable('municipalities')) {
         $municipalities = Municipality::all();
         $selectMunicipalities = array();
         $selectMunicipalities[0] = "Select / All";
         foreach ($municipalities as $municipality) {
             $selectMunicipalities[$municipality->slug] = $municipality->name;
         }
         \View::share('selectMunicipalities', $selectMunicipalities);
     }
     if (\Schema::hasTable('categories')) {
         $categories = Category::all();
         $selectCategories = array();
         $selectCategories[0] = "Select / All";
         foreach ($categories as $category) {
             $selectCategories[$category->slug] = $category->name;
         }
         \View::share('selectCategories', $selectCategories);
     }
     if (\Schema::hasTable('sub-categories')) {
         $subCategories = SubCategory::all();
         $selectSubCategories = array();
         $selectSubCategories[0] = "Select / All";
         foreach ($subCategories as $subCategory) {
             $selectSubCategories[$subCategory->slug] = $subCategory->name;
         }
         \View::share('selectSubCategories', $selectSubCategories);
     }
     if (\Schema::hasTable('sub-sub-categories')) {
         $subSubCategories = SubSubCategory::all();
         $selectSubSubCategories = array();
         $selectSubSubCategories[0] = "Select / All";
         foreach ($subSubCategories as $subSubCategory) {
             $selectSubSubCategories[$subSubCategory->slug] = $subSubCategory->name;
         }
         \View::share('selectSubSubCategories', $selectSubSubCategories);
     }
     if (\Schema::hasTable('relationships')) {
         $relationships = Relationship::all();
         $selectRelationships = array();
         $selectRelationships[0] = "Select / All";
         foreach ($relationships as $relationship) {
             $selectRelationships[$relationship->id] = $relationship->name;
         }
         \View::share('selectRelationships', $selectRelationships);
     }
     if (\Schema::hasTable('cases')) {
         $cases = \DB::table('cases')->join('users', 'cases.reporter', '=', 'users.id')->select(\DB::raw("\n                                                    IF(`cases`.`addressbook` = 1,(SELECT CONCAT(`FirstName`, ' ', `Surname`) FROM `addressbook` WHERE `addressbook`.`id`= `cases`.`reporter`), (SELECT CONCAT(users.`name`, ' ', users.`surname`) FROM `users` WHERE `users`.`id`= `cases`.`reporter`)) as reporterName\n\n                                                "))->get();
         $reporters = array();
         $reporters[0] = "Select / All";
         foreach ($cases as $case) {
             $reporters[$case->reporterName] = $case->reporterName;
         }
         \View::share('selectReporters', $reporters);
     }
     View()->composer('master', function ($view) {
         $view->with('addressBookNumber', addressbook::all());
         if (\Auth::check()) {
//.........这里部分代码省略.........
开发者ID:elieishimwe,项目名称:Siyaleader-Transnet,代码行数:101,代码来源:AppServiceProvider.php

示例9: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $departments = Department::orderBy('created_at', 'desc')->paginate(10);
     return view('admin.department.department', compact('departments'));
 }
开发者ID:polodev,项目名称:distanceLearning,代码行数:10,代码来源:DepartmentController.php


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