Home >Backend Development >PHP Tutorial >laravel5 routing configuration tips
It is too cumbersome to generate a route for each method of the controller,
Method 1,
<code>Route<span>::controller(<span>'demos'</span>, <span>'Demo2Controller'</span>);</span></code>
<code><?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Http\Requests; use App\Http\Controllers\Controller; <span><span>class</span><span>Demo2Controller</span><span>extends</span><span>Controller</span></span> { <span>/** * Responds to requests to GET /users */</span> public function getIndex() { <span>//</span><span>return</span><span>1</span>; } <span>/** * Responds to requests to GET /users/show/1 */</span> public function getShow($id) { <span>//</span><span>return</span> $id; } <span>/** * Responds to requests to GET /users/admin-profile */</span> public function getAdminProfile() { <span>//</span> } <span>/** * Responds to requests to POST /users/profile */</span> public function postProfile() { <span>//</span> } } </code>
Visit http://localhost:8000/demos/index
The above introduces laravel5 routing configuration skills, including aspects of content. I hope it will be helpful to friends who are interested in PHP tutorials.