Skip to content

Commit

Permalink
Merge pull request #217 from enoonan/master
Browse files Browse the repository at this point in the history
Fix issue #200 - address deprecated Input facade for Laravel version 6 and up, with 4.2 fallback
  • Loading branch information
Nayjest authored Apr 16, 2020
2 parents a8f9b43 + 9919d77 commit ccb25a6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/Components/Laravel5/Pager.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
namespace Nayjest\Grids\Components\Laravel5;

use Illuminate\Pagination\Paginator;
use Input;
use Illuminate\Support\Facades\App;
use Nayjest\Grids\Components\Base\RenderableComponent;
use Nayjest\Grids\Grid;

Expand All @@ -24,7 +24,11 @@ public function render()
protected function setupPaginationForReading()
{
Paginator::currentPageResolver(function () {
return Input::get("$this->input_key.page", 1);
if (version_compare(App::version(), '6.0', '>=')) {
return \Illuminate\Support\Facades\Request::input("$this->input_key.page", 1);
} else {
return \Illuminate\Support\Facades\Input::get("$this->input_key.page", 1);
}
});
}

Expand Down
7 changes: 6 additions & 1 deletion src/GridInputProcessor.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
namespace Nayjest\Grids;

use Illuminate\Support\Facades\App;
use Input;
use Request;
use Form;
Expand Down Expand Up @@ -37,7 +38,11 @@ public function __construct(Grid $grid)

protected function loadInput()
{
$this->input = Input::get($this->getKey(), []);
if (version_compare(App::version(), '6.0', '>=')) {
$this->input = \Illuminate\Support\Facades\Request::input($this->getKey(), []);
} else {
$this->input = \Illuminate\Support\Facades\Input::get($this->getKey(), []);
}
}

/**
Expand Down

0 comments on commit ccb25a6

Please sign in to comment.