Laravel of each operation must write a route
Routing laravel of the routes in the write web.php
code show as below
use App\Http\Resources\User as UserResource; use App\Model\Test\User; //Route::get('/', function () { // return view('welcome'); //}); //Route::get('/haha', function () { // return 'hehehe'; //}); Route::get('/',function (){ return view('welcome'); }); Route::get('/a','Admin\AdminController@hello'); //Closure function // use Illuminate \ Support \ Facades \ View; the Route :: GET ( ' / ' , function () { // return View ( 'weloce'); // convert JSON // return [ // 'A '=>' AAAA ', // ' B '=>' bbbb ' // ]; // to an array // return [. 1, 2,. 3]; // custom HTTP status code // return Response (' World hello ', 404) // -> header (' the Content-the Type ',' text / Plain '); // add the response header // return Response ( '$ Content', 200 is) // -> header ( 'the Content-the Type', 'text / Plain'); // add to the cookie in response // return Response ( '$ Content', 200 is) // -> header ( 'the Content-the Type', 'A = 10 '); // jump page // return the redirect (' the Admin \ Hello the UserController @ '); // return // return Back () -> withInput (); // array into the JSON: // return Response ( ) -> JSON ([ // 'name' => 'Abigail', // 'State' => 'the CA' // ]); // determines whether the file exists view // dd (view :: eXISTS ( 'emails . customer')); // return view('weloce'); }); //Route::any('users/{id}',"Admin\UserController@hello"); Route::view('text','text.text'); Route::get('/mysql','UserController@index'); Route::get('/model','UserController@test'); Route::any('/res',function (){ return new UserResource(User::find(1)); }); Route::get('/get','TestController@get'); Route::view('index','index'); Route::view('img','alert'); Route::any('user/{a?}',"TestController@test")->middleware('test'); //Route::any('users/{id}',"Admin\UserController@hello")->name('h'); //Route::any('users/hello',"Admin\UserController@hello")->name('h'); //
If the view