22 lines
719 B
PHP
22 lines
719 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\User;
|
|
use App\Services\WarehouseExchange;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Request;
|
|
|
|
class WarehouseExchangeController extends Controller
|
|
{
|
|
public function index(Request $request, WarehouseExchange $exchange): JsonResponse
|
|
{
|
|
$actor = $request->user('web');
|
|
abort_unless($actor instanceof User, 403);
|
|
$input = $request->validate(['cursor' => 'nullable|string|max:4096', 'limit' => 'sometimes|integer|min:1|max:100']);
|
|
|
|
return response()->json($exchange->page($actor, $input['cursor'] ?? null, (int) ($input['limit'] ?? 50)))
|
|
->header('Cache-Control', 'private, no-store, max-age=0');
|
|
}
|
|
}
|