Completed
Push — master ( 69a7c6...5199b6 )
by Song
02:55
created

SearchBar::render()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 14
rs 9.7998
c 0
b 0
f 0
1
<?php
2
3
namespace Encore\Admin\Grid\Tools;
4
5
use Encore\Admin\Grid\Concerns\HasSearchBar;
6
use Illuminate\Support\Arr;
7
8
class SearchBar extends AbstractTool
9
{
10
    /**
11
     * @var string
12
     */
13
    protected $view = 'admin::grid.search-bar';
14
15
    /**
16
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
17
     */
18
    public function render()
19
    {
20
        $query = request()->query();
21
22
        Arr::forget($query, HasSearchBar::$searchKey);
23
24
        $vars = [
25
            'action' => request()->url() . '?' . http_build_query($query),
26
            'key'    => HasSearchBar::$searchKey,
27
            'value'  => request(HasSearchBar::$searchKey),
28
        ];
29
30
        return view($this->view, $vars);
0 ignored issues
show
Bug Compatibility introduced by
The expression view($this->view, $vars); of type Illuminate\View\View|Ill...\Contracts\View\Factory adds the type Illuminate\Contracts\View\Factory to the return on line 30 which is incompatible with the return type declared by the interface Illuminate\Contracts\Support\Renderable::render of type string.
Loading history...
31
    }
32
}