mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/unity.git
synced 2026-08-19 20:34:01 +00:00
64 lines
1.4 KiB
PHP
64 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Modules\Admin;
|
|
|
|
use Auth;
|
|
use App\Models\Permission;
|
|
|
|
use App\Http\Helpers\General;
|
|
use App\Http\Helpers\Hasher;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Validator;
|
|
|
|
class PermissionModule
|
|
{
|
|
public function __construct()
|
|
{
|
|
|
|
}
|
|
|
|
public static function list(Request $request)
|
|
{
|
|
$name = $request->get('name', null);
|
|
$guard_name = $request->get('guard_name', null);
|
|
$status = $request->get('status', null);
|
|
$page = $request->get('page', null);
|
|
$limit = $request->get('limit', Permission::all()->count());
|
|
|
|
$query = Permission::query();
|
|
|
|
if (strlen($name) > 0) {
|
|
$query->where('name', $name);
|
|
}
|
|
|
|
if (strlen($guard_name) > 0) {
|
|
$query->where('guard_name', $guard_name);
|
|
}
|
|
|
|
if (strlen($status) > 0) {
|
|
$query->where('status', $status);
|
|
}
|
|
|
|
$query->orderBy('id', 'desc');
|
|
|
|
$params = [
|
|
'name' => $name,
|
|
'status' => $status,
|
|
'page' => $page
|
|
];
|
|
|
|
$role_list = $query->paginate($limit);
|
|
|
|
$extract = [];
|
|
foreach ($role_list as $key => $row) {
|
|
$extract[] = $row;
|
|
|
|
}
|
|
|
|
$pagination = General::PaginationGenerator($role_list, $params, $extract);
|
|
|
|
return $pagination;
|
|
}
|
|
}
|