Basic Controllers: Single Action Controllers
Single Action Controllers
<?php namespace App\Http\Controllers; use App\User; use App\Http\Controllers\Controller; class ShowProfile extends Controller
{ /**
* Show the profile for the given user.
*
* @param int $id
* @return Response
*/ public function __invoke($id)
{ return view('user.profile', ['user' => User::findOrFail($id)]); } } When registering routes for single action controllers, you do not need to specify a method.
Semantic portal