您好,我正在尝试使用 livewire 创建搜索查询。我想得到这样的特定查询: http://127.0.0.1:8000/users?page=1&name=abc
我该如何处理我的疑问?现在我的控制器和刀片视图如下所示:
public $page, $currentPage,$name;
public function submit(Request $request)
{
$input = $request->all();
dd($input);
}
public function mount(Request $request)
{
$value = session()->get('token');
$page = $request->input('page');
$client =new \GuzzleHttp\Client([
'http_errors' => false,
]);
$this->response = $client->get(env('API_URL').'users?', [
'query' => [
'page'=>$page,
'name'=>$this->name,
],
'headers' => [
'Authorization' => 'Bearer '.$value ,
'Accept' => 'application/json',
],
]);
$this->res = json_decode($this->response->getBody(), true);
}
慕容森