Laravel Nested Resource Controllers: Two-Level Deep

preview_player
Показать описание
A less-known feature of Laravel Controllers: you can manage one Model related to a Parent model.

- - - - -
Рекомендации по теме
Комментарии
Автор

Awesome tip, and I'll share my experience with Controller naming in nested resources. PostCommentController is fine, but in my app I go three levels in my api resource where I want the Team id in the url also like /teams/1/posts/1/comments and having a TeamPostCommentController just starts looking crazy in the file tree so I generate the controller with namespace like this to keep things tidier: artisan make:controller

cloudergnu
Автор

I have used 3 level depth of nested resources and it works!)

SaidakbarSadikov
Автор

Always you come up with some interesting stuff.

asifm
Автор

very good feature and thanks for sharing

LoganathanNatarajanlogudotcom
Автор

You can use abort_if laravel function)

popelyshyn
Автор

What does the href of the Comments button look like @ 1:14?

nickivallentgoed
Автор

Hey Povilas, it's not related to the topic but i noticed how you manage your user permission on the controller, and i was wondering how the method you are using: "abort_if(Gate:: .... " is better/different from just doing this: return users') ? view('users.create') : abort(401);

AlfredoElizondoLife
Автор

Hi, Thank you very much for those videos! They really help me in my day to day job :) Have you thought about using patreon for support the channel?

One thing have recently faced was to do Laravel project in subfolder on shared hosting. So would you be able to create such video?

niki.mihaylov
Автор

turning developer from crappy to professional

adebajooluwaseyi