1use App\Http\Controllers\UserController;
2
3Route::get('user/{id}', [UserController::class, 'show']);
1Route::resources([
2 'photos' => 'PhotoController',
3 'posts' => 'PostController',
4]);
1Verb Path Action Route Name
2GET /users index users.index
3GET /users/create create users.create
4POST /users store users.store
5GET /users/{user} show users.show
6GET /users/{user}/edit edit users.edit
7PUT|PATCH /users/{user} update users.update
8DELETE /users/{user} destroy users.destroy
1class UserController extends Controller
2{
3 /**
4 * Instantiate a new controller instance.
5 *
6 * @return void
7 */
8 public function __construct()
9 {
10 $this->middleware('auth');
11
12 $this->middleware('log')->only('index');
13
14 $this->middleware('subscribed')->except('store');
15 }
16}