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,6 +3,7 @@
namespace App\Http\Controllers\Admin\helpdesk;
// controller
use Illuminate\Support\Facades\Request;
use App\Http\Controllers\Controller;
// request
@@ -56,13 +57,13 @@ class ErrorAndDebuggingController extends Controller
$debug = ($debug) ? 'true' : 'false';
$bugsnag_debug = \Config::get('app.bugsnag_reporting');
$bugsnag_debug = ($bugsnag_debug) ? 'true' : 'false';
if ($debug != \Input::get('debug') || $bugsnag_debug != \Input::get('bugsnag')) {
if ($debug != Request::get('debug') || $bugsnag_debug != Request::get('bugsnag')) {
// dd($request->input());
$debug_new = base_path().DIRECTORY_SEPARATOR.'.env';
$datacontent = File::get($debug_new);
$datacontent = str_replace(
'APP_DEBUG='.$debug,
'APP_DEBUG='.\Input::get('debug'),
'APP_DEBUG='.Request::get('debug'),
$datacontent
);
File::put($debug_new, $datacontent);
@@ -72,7 +73,7 @@ class ErrorAndDebuggingController extends Controller
$datacontent2 = File::get($bugsnag_debug_new);
$datacontent2 = str_replace(
'APP_BUGSNAG='.$bugsnag_debug,
'APP_BUGSNAG='.\Input::get('bugsnag'),
'APP_BUGSNAG='.Request::get('bugsnag'),
$datacontent2
);
File::put($bugsnag_debug_new, $datacontent2);

View File

@@ -14,7 +14,7 @@ use Form;
// Class
use Illuminate\Http\Request;
use Illuminate\Support\Str;
use Input;
use Illuminate\Support\Facades\Request as Input;
use Lang;
use Redirect;

View File

@@ -14,7 +14,7 @@ use File;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\Session;
use Input;
use Illuminate\Support\Facades\Request;
use Lang;
use UnAuth;
use Validator;
@@ -134,9 +134,9 @@ class LanguageController extends Controller
try {
// getting all of the post data
$file = [
'File' => Input::file('File'),
'language-name' => Input::input('language-name'),
'iso-code' => Input::input('iso-code'),
'File' => Request::file('File'),
'language-name' => Request::input('language-name'),
'iso-code' => Request::input('iso-code'),
];
// setting up rules
@@ -155,14 +155,14 @@ class LanguageController extends Controller
//Checking if package already exists or not in lang folder
$path = base_path('resources/lang');
if (in_array(strtolower(Input::get('iso-code')), scandir($path))) {
if (in_array(strtolower(Request::get('iso-code')), scandir($path))) {
//sending back with error message
Session::flash('fails', Lang::get('lang.package_exist'));
Session::flash('link', 'change-language/'.strtolower(Input::get('iso-code')));
Session::flash('link', 'change-language/'.strtolower(Request::get('iso-code')));
return Redirect::back()->withInput();
} elseif (! array_key_exists(strtolower(Input::get('iso-code')), Config::get('languages'))) {//Checking Valid ISO code form Languages.php
} elseif (! array_key_exists(strtolower(Request::get('iso-code')), Config::get('languages'))) {//Checking Valid ISO code form Languages.php
//sending back with error message
Session::flash('fails', Lang::get('lang.iso-code-error'));
@@ -170,13 +170,13 @@ class LanguageController extends Controller
} else {
// checking file is valid.
if (Input::file('File')->isValid()) {
$name = Input::file('File')->getClientOriginalName(); //uploaded file's original name
if (Request::file('File')->isValid()) {
$name = Request::file('File')->getClientOriginalName(); //uploaded file's original name
$destinationPath = base_path('public/uploads/'); // defining uploading path
$extractpath = base_path('resources/lang').'/'.strtolower(Input::get('iso-code')); //defining extracting path
$extractpath = base_path('resources/lang').'/'.strtolower(Request::get('iso-code')); //defining extracting path
mkdir($extractpath); //creating directroy for extracting uploadd file
//mkdir($destinationPath);
Input::file('File')->move($destinationPath, $name); // uploading file to given path
Request::file('File')->move($destinationPath, $name); // uploading file to given path
\Zipper::make($destinationPath.'/'.$name)->extractTo($extractpath); //extracting file to give path
//check if Zip extract foldercontains any subfolder
$directories = File::directories($extractpath);
@@ -194,7 +194,7 @@ class LanguageController extends Controller
} else {
// sending back with success message
Session::flash('success', Lang::get('lang.upload-success'));
Session::flash('link', 'change-language/'.strtolower(Input::get('iso-code')));
Session::flash('link', 'change-language/'.strtolower(Request::get('iso-code')));
return Redirect::route('LanguageController');
}

View File

@@ -13,7 +13,7 @@ use App\User;
use Auth;
use Exception;
use Hash;
use Input;
use Illuminate\Support\Facades\Request;
/**
* ProfileController.
@@ -94,13 +94,13 @@ class ProfileController extends Controller
$user->profile_pic = $name;
}
}
if (Input::file('profile_pic')) {
//$extension = Input::file('profile_pic')->getClientOriginalExtension();
$name = Input::file('profile_pic')->getClientOriginalName();
if (Request::file('profile_pic')) {
//$extension = Request::file('profile_pic')->getClientOriginalExtension();
$name = Request::file('profile_pic')->getClientOriginalName();
$destinationPath = 'lb-faveo/profilepic';
$fileName = rand(0000, 9999).'.'.$name;
//echo $fileName;
Input::file('profile_pic')->move($destinationPath, $fileName);
Request::file('profile_pic')->move($destinationPath, $fileName);
$user->profile_pic = $fileName;
} else {
$user->fill($request->except('profile_pic', 'gender', 'active', 'role', 'is_delete', 'ban'))->save();

View File

@@ -39,7 +39,7 @@ use Exception;
use File;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
use Input;
use Illuminate\Support\Facades\Request as Input;
use Lang;
/**
@@ -866,13 +866,13 @@ class SettingsController extends Controller
public function saveConditions()
{
if (\Input::get('fetching-commands') && \Input::get('notification-commands')) {
$fetching_commands = \Input::get('fetching-commands');
$fetching_dailyAt = \Input::get('fetching-dailyAt');
$notification_commands = \Input::get('notification-commands');
$notification_dailyAt = \Input::get('notification-dailyAt');
$work_commands = \Input::get('work-commands');
$workflow_dailyAt = \Input::get('workflow-dailyAt');
if (Input::get('fetching-commands') && Input::get('notification-commands')) {
$fetching_commands = Input::get('fetching-commands');
$fetching_dailyAt = Input::get('fetching-dailyAt');
$notification_commands = Input::get('notification-commands');
$notification_dailyAt = Input::get('notification-dailyAt');
$work_commands = Input::get('work-commands');
$workflow_dailyAt = Input::get('workflow-dailyAt');
$fetching_command = $this->getCommand($fetching_commands, $fetching_dailyAt);
$notification_command = $this->getCommand($notification_commands, $notification_dailyAt);
$work_command = $this->getCommand($work_commands, $workflow_dailyAt);

View File

@@ -33,7 +33,7 @@ use DB;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
use Input;
use Illuminate\Support\Facades\Request as Input;
use Lang;
/**

View File

@@ -16,7 +16,7 @@ use App\Model\helpdesk\Utility\Languages;
// classes
use Exception;
use Illuminate\Http\Request;
use Input;
use Illuminate\Support\Facades\Request as Input;
/**
* TemplateController.