diff --git a/app/Models/Auth/Role.php b/app/Models/Auth/Role.php index 5e5aebada..72ab05537 100644 --- a/app/Models/Auth/Role.php +++ b/app/Models/Auth/Role.php @@ -29,6 +29,35 @@ class Role extends LaratrustRole */ public $cloneable_relations = ['permissions']; + /** + * Scope to get all rows filtered, sorted and paginated. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param $sort + * + * @return \Illuminate\Database\Eloquent\Builder + */ + public function scopeCollect($query, $sort = 'display_name') + { + $request = request(); + + $search = $request->get('search'); + $limit = (int) $request->get('limit', setting('default.list_limit', '25')); + + return $query->usingSearchString($search)->sortable($sort)->paginate($limit); + } + + /** + * @inheritDoc + * + * @param Document $src + * @param boolean $child + */ + public function onCloning($src, $child = null) + { + $this->name = $src->name . '-' . Role::max('id') + 1; + } + /** * Get the line actions. * @@ -71,33 +100,4 @@ class Role extends LaratrustRole return $actions; } - - /** - * Scope to get all rows filtered, sorted and paginated. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param $sort - * - * @return \Illuminate\Database\Eloquent\Builder - */ - public function scopeCollect($query, $sort = 'display_name') - { - $request = request(); - - $search = $request->get('search'); - $limit = (int) $request->get('limit', setting('default.list_limit', '25')); - - return $query->usingSearchString($search)->sortable($sort)->paginate($limit); - } - - /** - * @inheritDoc - * - * @param Document $src - * @param boolean $child - */ - public function onCloning($src, $child = null) - { - $this->name = $src->name . '-' . Role::max('id') + 1; - } }