Convert Input to Request facade

Laravel 5.2 no longer registers the `Input` facade by default. While
still available in Laravel 5, the `Input` facade is removed in
Laravel 6.
This commit is contained in:
Shift
2023-01-07 18:48:11 +00:00
parent 67bf088f27
commit 723ac38edd
25 changed files with 98 additions and 91 deletions

View File

@@ -3,7 +3,7 @@
namespace App\Http\Middleware;
use Closure;
use Input;
use Illuminate\Support\Facades\Request;
//use Redirect;
@@ -18,20 +18,20 @@ class TicketViewURL
*/
public function handle($request, Closure $next)
{
// dd(\Input::all(), $request->fullUrl());
// dd(Request::all(), $request->fullUrl());
$request_str = $request->fullUrl();
if (preg_match('([^D]=)', $request_str) == 1) {
$request_str = str_replace('=', '%5B%5D=', $request_str);
$request_str = str_replace('%5B%5D%5B%5D=', '%5B%5D=', $request_str);
}
if (count(Input::all()) == 0) {
if (count(Request::all()) == 0) {
return \Redirect::to('tickets?show%5B%5D=inbox&departments%5B%5D=All');
} else {
if (! array_key_exists('show', Input::all()) && ! array_key_exists('departments', Input::all())) {
if (! array_key_exists('show', Request::all()) && ! array_key_exists('departments', Request::all())) {
return \Redirect::to($request_str.'&show%5B%5D=inbox&departments%5B%5D=All');
} elseif (! array_key_exists('show', Input::all()) && array_key_exists('departments', Input::all())) {
} elseif (! array_key_exists('show', Request::all()) && array_key_exists('departments', Request::all())) {
return \Redirect::to($request_str.'&show%5B%5D=inbox');
} elseif (array_key_exists('show', Input::all()) && ! array_key_exists('departments', Input::all())) {
} elseif (array_key_exists('show', Request::all()) && ! array_key_exists('departments', Request::all())) {
return \Redirect::to($request_str.'&departments%5B%5D=All');
} else {
// do nothing