I have an error when upgrading laravel 6
Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR) Class 'Illuminate\Support\Facades\Input' not found
Source code:
ERROR:
can you help to fix my code?
In Laravel 5.2 Input:: is replaced with Request:: Laravel 6X The Input facade, which was primarily a duplicate of the Request facade, has been removed. If you are using the Input::get method, you should now call the Request::input method. All other calls to the Input facade may simply be updated to use the Request facade.
Hotswap the underlying instance behind the facade. Get the root object behind the facade. Get the registered name of the component. Resolve the facade root instance from the container. Clear a resolved facade instance.
Convert the facade into a Mockery spy. Initiate a mock expectation on the facade. Create a fresh mock instance for the given class. Create a fresh mock instance for the given class. Determines whether a mock is set as the instance of the facade. Get the mockable class for the bound instance. Hotswap the underlying instance behind the facade.
In config/app.php
, replace:
'Input' => Illuminate\Support\Facades\Input::class
with
'Input' => Illuminate\Support\Facades\Request::class,
I have resolved below it worked for me
Step 1: Access the link: yourproject\vendor\laravel\framework\src\Illuminate\Support\Facades
Step 2: Create a file with the file name: Input.php
Step 3: Paste the code below into the file you just created and save
<?php
namespace Illuminate\Support\Facades;
/**
* @method static \Illuminate\Http\Request instance()
* @method static string method()
* @method static string root()
* @method static string url()
* @method static string fullUrl()
* @method static string fullUrlWithQuery(array $query)
* @method static string path()
* @method static string decodedPath()
* @method static string|null segment(int $index, string|null $default = null)
* @method static array segments()
* @method static bool is(...$patterns)
* @method static bool routeIs(...$patterns)
* @method static bool fullUrlIs(...$patterns)
* @method static bool ajax()
* @method static bool pjax()
* @method static bool secure()
* @method static string ip()
* @method static array ips()
* @method static string userAgent()
* @method static \Illuminate\Http\Request merge(array $input)
* @method static \Illuminate\Http\Request replace(array $input)
* @method static \Symfony\Component\HttpFoundation\ParameterBag|mixed json(string $key = null, $default = null)
* @method static \Illuminate\Session\Store session()
* @method static \Illuminate\Session\Store|null getSession()
* @method static void setLaravelSession(\Illuminate\Contracts\Session\Session $session)
* @method static mixed user(string|null $guard = null)
* @method static \Illuminate\Routing\Route|object|string route(string|null $param = null)
* @method static string fingerprint()
* @method static \Illuminate\Http\Request setJson(\Symfony\Component\HttpFoundation\ParameterBag $json)
* @method static \Closure getUserResolver()
* @method static \Illuminate\Http\Request setUserResolver(\Closure $callback)
* @method static \Closure getRouteResolver()
* @method static \Illuminate\Http\Request setRouteResolver(\Closure $callback)
* @method static array toArray()
* @method static bool offsetExists(string $offset)
* @method static mixed offsetGet(string $offset)
* @method static void offsetSet(string $offset, $value)
* @method static void offsetUnset(string $offset)
*
* @see \Illuminate\Http\Request
*/
class Input extends Facade
{
/**
* Get an item from the input data.
*
* This method is used for all request verbs (GET, POST, PUT, and DELETE)
*
* @param string $key
* @param mixed $default
* @return mixed
*/
public static function get($key = null, $default = null)
{
return static::$app['request']->input($key, $default);
}
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'request';
}
}
Step 4: Rerun your project
Done.Good luck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With