Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

CATCHING URL FROM ROUTE // php laravel

use Illuminate\Http\Request;

use Illuminate\Support\Facades\Input;

Although I use these libraries, the input gives an error. Even if I add request or name input path to app.php in the config file, the problem is not resolved.

public function get_deneme(){
    $name=Input::get('name');
    $var="asd";
    return view('deneme')->with('var',$var);
}

ERROR: Input is underlined (Undefined type ‘Illuminate\Support\Facades\Input’.)

NOTE : Laravel Framework 9.29.0

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

As aynber mentioned in the comments Input was a very very old feature, since Laravel 5.2 you can use the following to get inputs

request()->get('name');

But since this still is not the best way to use the request, you can do it like this

use Illuminate\Http\Request

public function get_deneme(Request $request){
   $name = $request->name;
   $var = "asd";

   return view('deneme')->with('var',$var);
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading