Ability to configure per page number
This commit is contained in:
@@ -12,12 +12,12 @@ class ServiceController extends Controller
|
||||
public function index()
|
||||
{
|
||||
return inertia('Admin/Services/Index', [
|
||||
'servers' => Server::query()->withCount('sites', 'users')->latest()->paginate(5, ['*'], 'servers_per_page'),
|
||||
'sites' => Site::with('server:id,name')->withCount('users')->latest()->paginate(5, ['*'], 'sites_per_page'),
|
||||
'servers' => Server::query()->withCount('sites', 'users')->latest()->paginate(config('core.pagination.per_page'), ['*'], 'servers_per_page'),
|
||||
'sites' => Site::with('server:id,name')->withCount('users')->latest()->paginate(config('core.pagination.per_page'), ['*'], 'sites_per_page'),
|
||||
'providers' => Provider::query()
|
||||
->withCount('regions', 'plans', 'servers')
|
||||
->latest()
|
||||
->paginate(5, ['*'], 'providers_per_page'),
|
||||
->paginate(config('core.pagination.per_page'), ['*'], 'providers_per_page'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ class UserController extends Controller
|
||||
return $query->where('name', 'like', '%' . $value . '%')->orWhere('email', 'like', '%' . $value . '%');
|
||||
})
|
||||
->latest()
|
||||
->paginate(5);
|
||||
->paginate(config('core.pagination.per_page'));
|
||||
|
||||
return inertia('Admin/Users/Index', [
|
||||
'filters' => request()->all('search'),
|
||||
@@ -57,9 +57,9 @@ class UserController extends Controller
|
||||
{
|
||||
$user = User::query()->findOrFail($id);
|
||||
|
||||
$servers = $user->servers()->withCount('sites')->latest()->paginate(5, ['*'], 'page_servers');
|
||||
$servers = $user->servers()->withCount('sites')->latest()->paginate(config('core.pagination.per_page'), ['*'], 'page_servers');
|
||||
|
||||
$sites = $user->sites()->with('server:id,name')->latest()->paginate(5, ['*'], 'page_sites');
|
||||
$sites = $user->sites()->with('server:id,name')->latest()->paginate(config('core.pagination.per_page'), ['*'], 'page_sites');
|
||||
|
||||
return inertia('Admin/Users/Show', [
|
||||
'user' => $user,
|
||||
|
||||
7
config/core.php
Normal file
7
config/core.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'pagination' => [
|
||||
'per_page' => env('PAGINATION_PER_PAGE', 5)
|
||||
]
|
||||
];
|
||||
2
public/js/app.js
vendored
2
public/js/app.js
vendored
File diff suppressed because one or more lines are too long
@@ -142,7 +142,7 @@ export default {
|
||||
|
||||
computed: {
|
||||
hasAccessToServers () {
|
||||
return this.$page.props.auth.can.length && (this.$page.props.auth.can.servers.create || this.$page.props.auth.can.servers.update || this.$page.props.auth.can.servers.delete);
|
||||
return Object.keys(this.$page.props.auth.can).length && (this.$page.props.auth.can.servers.create || this.$page.props.auth.can.servers.update || this.$page.props.auth.can.servers.delete);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ export default {
|
||||
title: this.__('Sites'),
|
||||
to: this.route('sites.index'),
|
||||
},
|
||||
this.$page.props.auth.can.length && (this.$page.props.auth.can.servers.create || this.$page.props.auth.can.servers.update || this.$page.props.auth.can.servers.delete) ? {
|
||||
Object.keys(this.$page.props.auth.can).length && (this.$page.props.auth.can.servers.create || this.$page.props.auth.can.servers.update || this.$page.props.auth.can.servers.delete) ? {
|
||||
title: this.__('Servers'),
|
||||
to: this.route('servers.index'),
|
||||
} : null,
|
||||
|
||||
@@ -42,7 +42,7 @@ export default {
|
||||
to: this.route('sites.index'),
|
||||
active: this.route().current('sites.*')
|
||||
},
|
||||
this.$page.props.auth.can.length && (this.$page.props.auth.can.servers.create || this.$page.props.auth.can.servers.update || this.$page.props.auth.can.servers.delete) ? {
|
||||
Object.keys(this.$page.props.auth.can).length && (this.$page.props.auth.can.servers.create || this.$page.props.auth.can.servers.update || this.$page.props.auth.can.servers.delete) ? {
|
||||
title: this.__('Servers'),
|
||||
to: this.route('servers.index'),
|
||||
} : null,
|
||||
|
||||
Reference in New Issue
Block a user