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


PHP Role::orderBy方法代码示例

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


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

示例1: testStore

 public function testStore()
 {
     $this->withSession(['SOURCE_URL' => URL::route('role.create')]);
     $this->withoutMiddleware();
     $this->call('POST', '/role', $this->systemRoleWorks);
     $role = Role::orderBy('id', 'desc')->first();
     $this->assertEquals($this->systemRoleWorks['name'], $role->name);
     $this->call('POST', '/role', $this->systemRoleFailsValidationNoName);
     // todo: the test environment has source route '/' on failure redirect->back() -> the test below wont do
     // $this->assertRedirectedToRoute('role.create');
     // todo: this is the best I can do for now
     // $this->assertSessionHasErrors('name');
     $this->assertSessionHasErrors();
     $this->call('POST', '/role', $this->systemRoleFailsValidationSameRole);
     // todo: redirect is failing for some reason
     // todo: the test environment has source route '/' on failure redirect->back() -> the test below wont do
     // $this->assertRedirectedToRoute('role.create');
     // todo: this is the best I can do for now
     // $this->assertSessionHasErrors('name');
     $this->assertSessionHasErrors();
     $this->call('POST', '/role', $this->systemRoleFailsValidationShortRole);
     $this->assertRedirectedToRoute('role.create');
     // todo: this is the best I can do for now
     // $this->assertSessionHasErrors('name');
     $this->assertSessionHasErrors();
 }
开发者ID:echiteri,项目名称:iBLIS,代码行数:26,代码来源:RoleControllerTest.php

示例2: getAllRoles

 /**
  * @param  string  $order_by
  * @param  string  $sort
  * @param  bool    $withPermissions
  * @return mixed
  */
 public function getAllRoles($order_by = 'id', $sort = 'asc', $withPermissions = false)
 {
     if ($withPermissions) {
         return Role::with('permissions')->orderBy($order_by, $sort)->get();
     }
     return Role::orderBy($order_by, $sort)->get();
 }
开发者ID:aysenli,项目名称:laravel5-backend,代码行数:13,代码来源:RoleRepository.php

示例3: lastUpdated

 public function lastUpdated()
 {
     $query = Role::orderBy('updated_at', 'DESC')->first();
     if ($query) {
         return $query->updated_at->format('Y-m-d H:i:s');
     }
     return date("Y-m-d H:i:s");
 }
开发者ID:ardiqghenatya,项目名称:koptel2,代码行数:8,代码来源:RoleRepository.php

示例4: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $roles = Role::orderBy('created_at', 'DESC')->paginate(10);
     return view('backend.role.index', compact('roles'));
 }
开发者ID:phillipmadsen,项目名称:app,代码行数:10,代码来源:RoleController.php

示例5: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param User $user
  * @return \Illuminate\View\View
  */
 public function edit(User $user)
 {
     $roles = Role::orderBy('id', 'asc')->get();
     return view('admin.user.edit', ['user' => $user, 'roles' => $roles]);
 }
开发者ID:lyovkin,项目名称:elcoinbank,代码行数:11,代码来源:AdminUserController.php

示例6: groups_roles

 public function groups_roles()
 {
     $data['title'] = "Associate Roles to Groups";
     $data['groups'] = Group::orderBy('display_name')->paginate(PAGINATION);
     $data['roles'] = Role::orderBy('display_name')->get();
     return view('groups/groups_roles', $data);
 }
开发者ID:pinkynrg,项目名称:convergence2.0,代码行数:7,代码来源:GroupsController.php

示例7: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param User $user
  * @return \Illuminate\View\View
  */
 public function edit(User $user)
 {
     $roles = Role::orderBy('id', 'asc')->get();
     $page = $_SERVER['HTTP_REFERER'];
     return view('admin.user.edit', ['user' => $user, 'roles' => $roles])->with('page', $page);
 }
开发者ID:lyovkin,项目名称:v2board,代码行数:12,代码来源:AdminUserController.php

示例8: getAllOrderedBy

 public function getAllOrderedBy($column = 'id', $order = 'asc')
 {
     $roles = Role::orderBy($column, $order)->get();
     return $roles;
 }
开发者ID:jaumesala,项目名称:opendata-maps,代码行数:5,代码来源:RoleRepository.php


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