chore: init saasshop repo + sql migrations runner + gitee go
This commit is contained in:
35
app/Http/Controllers/MerchantAdmin/UserController.php
Normal file
35
app/Http/Controllers/MerchantAdmin/UserController.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\MerchantAdmin;
|
||||
|
||||
use App\Http\Controllers\Concerns\ResolvesMerchantContext;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\User;
|
||||
use App\Support\CacheKeys;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
use ResolvesMerchantContext;
|
||||
|
||||
public function index(Request $request): View
|
||||
{
|
||||
$merchantId = $this->merchantId($request);
|
||||
|
||||
$page = max((int) $request->integer('page', 1), 1);
|
||||
|
||||
return view('merchant_admin.users.index', [
|
||||
'users' => Cache::remember(
|
||||
CacheKeys::merchantUsersList($merchantId, $page),
|
||||
now()->addMinutes(10),
|
||||
fn () => User::query()->forMerchant($merchantId)->latest()->paginate(10)->withQueryString()
|
||||
),
|
||||
'cacheMeta' => [
|
||||
'store' => config('cache.default'),
|
||||
'ttl' => '10m',
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user