Skip to content

Commit

Permalink
增加 Grid\Filter::addVariables() 方法
Browse files Browse the repository at this point in the history
  • Loading branch information
jqhph committed Apr 27, 2021
1 parent 2d62af3 commit f591f4e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Grid/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
use Dcat\Admin\Grid\Filter\Year;
use Dcat\Admin\Support\Helper;
use Dcat\Admin\Traits\HasBuilderEvents;
use Dcat\Admin\Traits\HasVariables;
use Illuminate\Contracts\Support\Renderable;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
Expand Down Expand Up @@ -70,6 +71,7 @@ class Filter implements Renderable
{
use HasBuilderEvents;
use Macroable;
use HasVariables;

const MODE_RIGHT_SIDE = 'right-side';
const MODE_PANEL = 'panel';
Expand Down Expand Up @@ -708,7 +710,12 @@ public function render()
$this->view = $this->mode === static::MODE_RIGHT_SIDE ? 'admin::filter.right-side-container' : 'admin::filter.container';
}

return view($this->view)->with([
return view($this->view)->with($this->variables())->render();
}

protected function defaultVariables()
{
return [
'action' => $this->action ?: $this->urlWithoutFilters(),
'layout' => $this->layout,
'filterID' => $this->disableCollapse ? '' : $this->filterID,
Expand All @@ -717,7 +724,7 @@ public function render()
'border' => $this->border,
'containerClass' => $this->containerClass,
'disableResetButton' => $this->disableResetButton,
])->render();
];
}

/**
Expand Down

0 comments on commit f591f4e

Please sign in to comment.