laravel 5 : Class 'input' not found

前端 未结 14 903
滥情空心
滥情空心 2020-12-02 07:35

In my routes.php file I have :

Route::get(\'/\', function () {

    return view(\'login\');
});

Route::get(\'/index\', function(){
    return v         


        
相关标签:
14条回答
  • 2020-12-02 08:14

    You can add a facade in your folder\config\app.php

    'Input' => Illuminate\Support\Facades\Input::class,
    
    0 讨论(0)
  • 2020-12-02 08:15

    In first your problem is about the spelling of the input class, should be Input instead of input. And you have to import the class with the good namespace.

    use Illuminate\Support\Facades\Input;
    

    If you want it called 'input' not 'Input', add this :

    use Illuminate\Support\Facades\Input as input;
    

    Second, It's a dirty way to store into the database via route.php, and you're not processing data validation. If a sent parameter isn't what you expected, maybe an SQL error will appear, its caused by the data type. You should use controller to interact with information and store via the model in the controller method.

    The route.php file handles routing. It is designed to make the link between the controller and the asked route.

    To learn about controller, middleware, model, service ... http://laravel.com/docs/5.1/

    If you need some more information, solution about problem you can join the community : https://laracasts.com/

    Regards.

    0 讨论(0)
提交回复
热议问题