Laravel Route Grouping: Simple to Very Complex

  Рет қаралды 48,443

Laravel Daily

Laravel Daily

Күн бұрын

Пікірлер: 74
@DanielJimenez-ig8mv
@DanielJimenez-ig8mv 5 ай бұрын
Hi sr Laravel Daily, I want to tahnks you for videos. I learned too much , greetings from Chile
@n1vz3r
@n1vz3r 2 жыл бұрын
Thanks to your video, I was able to get some answers while I was shaving )
@AAlani-uz4gm
@AAlani-uz4gm 2 жыл бұрын
Thanks Povilas, this helped me solve a problem i had with namespaces
@leslysuarez9686
@leslysuarez9686 2 жыл бұрын
I just finished the activity you have in your repository about the routes and I realized that I was half lost, but thanks to that now I know a little more. Thank you very much for your time. I saw this video several times that I did not understand well about the route group 🤯
@belce1982
@belce1982 3 жыл бұрын
Thanks as always, learning day by day thanks to you Povilas!
@aomo5293
@aomo5293 4 жыл бұрын
So Clear, Thank you very much.
@LeigerGaming
@LeigerGaming 4 жыл бұрын
I did not know about apiResource! Legend.
@Oda3908
@Oda3908 3 жыл бұрын
Great tutorial! Will be even better if mentioned on some option methods such as overwrite the default parameter name.
@amrullahdev8895
@amrullahdev8895 4 жыл бұрын
Such a awesome explanation and tutorial from the simple to advance . Thanks
@ChangeYourLifeForever
@ChangeYourLifeForever Жыл бұрын
really thank you great explanation
@Mariia-lr4vx
@Mariia-lr4vx Жыл бұрын
Excellent explanations! Thank you a lot!
@HenryDavidLie
@HenryDavidLie 4 жыл бұрын
Your explanation is so on point, i really like that, thankyou!
@AsankaRubasinghe
@AsankaRubasinghe 3 жыл бұрын
Thank you very much for the great explanation sir..
@nikkolumahang
@nikkolumahang 4 жыл бұрын
Really nice. I love your practical examples. Keep it up!
@lloydguia3118
@lloydguia3118 3 жыл бұрын
huli ka hahahah
@nikkolumahang
@nikkolumahang 3 жыл бұрын
@@lloydguia3118 follower diay pud ka ani nga channel? hahaha
@lloydguia3118
@lloydguia3118 3 жыл бұрын
@@nikkolumahang Oh hahaha dali ra kaayu ma sabtang iyang tuto
@nikkolumahang
@nikkolumahang 3 жыл бұрын
@@lloydguia3118 ayos kaayo iyang mga tips sa laravel
3 жыл бұрын
Awesome, awesome, awesome. Thank you Korop!
@issaissifou4959
@issaissifou4959 3 жыл бұрын
Thank you!
@upliftingspirit6873
@upliftingspirit6873 2 жыл бұрын
I have watched more than 20 videos in just 2 days. This channel is all I was looking for, thank you very much for the effort you put for these videos! I want to ask something. How would you format your resource routes if some actions have different middlewares than the rest? For example, create is allowed for authenticated users, but edit is allowed for authenticated AND the user must own the resource
@LaravelDaily
@LaravelDaily 2 жыл бұрын
I would use Policies for this.
@upliftingspirit6873
@upliftingspirit6873 2 жыл бұрын
@@LaravelDaily Yeah but still the policies have to be assigned (?) (or in the resource controller) Can this be achieved entirely in the routes file ? Namely, assign separate middleware, ie ['middleware' => ['create'=>'create-resource', 'edit' => 'edit-resource']]
@LaravelDaily
@LaravelDaily 2 жыл бұрын
I don't think I've seen that defined in the routes. You activate the middleware for specific controller method directly in that method of that controller. Or, in the constructor: public function __construct() { $this->middleware('auth'); $this->middleware('log')->only('index');
@upliftingspirit6873
@upliftingspirit6873 2 жыл бұрын
@@LaravelDaily Yeah that's the alternative way I saw as well; i guess having them all in the constructor sounds better. Thanks:)
@azhanhannan1227
@azhanhannan1227 2 жыл бұрын
great sharing, i've learn a l
@judenoel7286
@judenoel7286 Жыл бұрын
This was great very very useful 👌
@chlouis-girardot
@chlouis-girardot 4 жыл бұрын
Just awesome ! Thank you so much 👍🏼
@nurudeenqoyyumtimilehin5475
@nurudeenqoyyumtimilehin5475 4 жыл бұрын
If you rewind this video to get one or two concept, thumbs up.
@redayoub
@redayoub 4 жыл бұрын
thanks for this informative video
@amgadalwattar2863
@amgadalwattar2863 2 жыл бұрын
thanks
@waelmoh
@waelmoh 3 жыл бұрын
Big like
@valcmeza
@valcmeza 4 жыл бұрын
Great video!
@REDIDSoft
@REDIDSoft 4 жыл бұрын
Amazing videos!!!
@iHariPatel
@iHariPatel 4 жыл бұрын
Thank you
@neelnitin2850
@neelnitin2850 3 жыл бұрын
You are osm man...👍👍
@NebsterSK
@NebsterSK 4 жыл бұрын
It took me a long time to realise that you can have route group WITHOUT prefix & name. I thought it is mandatory.
@SpuxyYEZ
@SpuxyYEZ 4 жыл бұрын
but its actually purpose of group to use name/prefix because middleware and l8 doc advices to use middlewares in controllers + namespacing in laravel8 is not usable anymore because of "Class name resolution"
@R0b3
@R0b3 Жыл бұрын
Hi there. How can I divide my routes that share the same method?I have different roles in my application, admis, doctor, management and so on. I've made a CRUD controller and some methods are allowed and other no by check different roles. How can I reach my scope? I used a Resource controller but I don't know how can I split them. Thanks.
@madaminmj8462
@madaminmj8462 Жыл бұрын
which one is right approach 1. writing auth middleware in route.php 2. writing middleware in controller with construct like this public function __construct() { $this->middleware('auth')->except(['index', 'show']); }
@ifeanyinnaemego
@ifeanyinnaemego 5 ай бұрын
The first option is the preferred option
@relliv2019
@relliv2019 4 жыл бұрын
i am using laravel 6, jwt and custom role-permission system, now i am working this method. is it best practise? or any suggestion? /** * Plane */ Route::namespace('Plane')->prefix('plane')->group(function () { /** * Airports */ Route::namespace('Airport')->prefix('airport')->group(function () { $ct = 'AirportController'; Route::get('list', "{$ct}@index")->middleware('role:show_airport'); Route::post('', "{$ct}@store")->middleware('role:add_airport'); Route::get('cities', "{$ct}@cities")->middleware('role:show_airport'); Route::group([ 'prefix' => '{id}', 'where' => [ 'id' => '[0-9]+' ]], function () use ($ct) { Route::get('', "{$ct}@show")->middleware('role:show_airport'); Route::put('', "{$ct}@update")->middleware('role:edit_airport'); Route::delete('', "{$ct}@destroy")->middleware('role:delete_airport'); }); }); });
@samiullah0011
@samiullah0011 3 жыл бұрын
Hey Daily What should syntax be the name of folder in Controller. Mean folder name is singular or plural. Like you created folder called Admin. For example I want to create Category or Categories?
@LaravelDaily
@LaravelDaily 3 жыл бұрын
It's your personal choice
@thesemicolon1971
@thesemicolon1971 4 жыл бұрын
Can you please give some resources related to subdomain routing, generating subdomain for every user like you do in quick admin panel when a bee panel is generated
@PovilasKorop
@PovilasKorop 4 жыл бұрын
This video may help kzbin.info/www/bejne/emOYdKupj7SBrMU But, of course, configuring wildcard subdomain routing requires the web-server and DNS configuration, not only code. So this topic is outside Laravel.
@yuliarahma1300
@yuliarahma1300 3 жыл бұрын
if i put controller in sub folder like App\Http\Controllers\Sub1\Sub2\HomeController , how i call it on the route? thanks.
@LaravelDaily
@LaravelDaily 3 жыл бұрын
You call it with full namespace, App\Http...
@yuliarahma1300
@yuliarahma1300 3 жыл бұрын
@@LaravelDaily got it, can it combine with route prefix ?
@LaravelDaily
@LaravelDaily 3 жыл бұрын
Yes. Read the Laravel docs for that.
@overLordOrigin
@overLordOrigin 3 жыл бұрын
hi. how can send parameters inside group of middleware?
@LaravelDaily
@LaravelDaily 3 жыл бұрын
You can't send parameters to a group, only to a route
@overLordOrigin
@overLordOrigin 3 жыл бұрын
@@LaravelDaily have not any solutions?i am forcing to use groups
@LaravelDaily
@LaravelDaily 3 жыл бұрын
I don't even imagine how parameters would be used in groups, if each route may have individual parameters. To me, it's not logical.
@ForzaPilot
@ForzaPilot 4 жыл бұрын
Good morning! I'm new to Laravel, and I'm having an issue with eloquent relationships. I have a table for cars and I want to create a relationship with a table for builds. My issue is I haven't been able to figure out how to create the relationship of the build to the car when I enter the build. I have the car_id field working in the build table, but I've only been able to make it work manually. How do I make the relationship of the build to the car work from the build.create.php file?
@ExpDev69
@ExpDev69 4 жыл бұрын
In your Car model, have a relationship build() which "$this->hasOne(Build::class)". In your Build model, have a relationship car() which "$this->belongsTo(Car::class)". You should now be able to use $car->build or $build->car respectively. This assumes that your builds table have a car_id column that points to the car that specific build belongs to.
@ForzaPilot
@ForzaPilot 4 жыл бұрын
Exp Dev The real world examples you’ve done have been very helpful. Could you use my example to show how this is done, or have you already done an example like this? If you’ve already done one please share the link. Thank you for your help!
@ForzaPilot
@ForzaPilot 4 жыл бұрын
Exp Dev It feels like learning how to do this will open up so many possibilities for using Laravel for my projects.
@ExpDev69
@ExpDev69 4 жыл бұрын
@@ForzaPilot You should read the documentation for real world examples and explanations: laravel.com/docs/7.x/eloquent
@ForzaPilot
@ForzaPilot 4 жыл бұрын
Exp Dev Considering how this seems to be one of the core strengths of Laravel I’m surprised I haven’t found a video that shows how to achieve this functionality.
@devope
@devope 3 ай бұрын
in dev world it is common to pronounce "roUt"
@UIRETU
@UIRETU 4 жыл бұрын
In laravel 8 this code is completly different
@ClickShot18mm
@ClickShot18mm 4 жыл бұрын
Which IDE you use?
@PovilasKorop
@PovilasKorop 4 жыл бұрын
Phpstorm
@KoganeNoYubi
@KoganeNoYubi 4 жыл бұрын
in laravel 8 u cant use strings anymore in route definitions , would have to be: Route::resource('/tasks',TaskController::class);
@PovilasKorop
@PovilasKorop 4 жыл бұрын
What? I haven't heard of such a change, can you give any link to the documentation or Github change?
@relliv2019
@relliv2019 4 жыл бұрын
@@PovilasKorop kzbin.info/www/bejne/g5eoYqekgqxpnKc
@JY-xv7ic
@JY-xv7ic 4 жыл бұрын
please enable CC..
@soniablanche5672
@soniablanche5672 3 жыл бұрын
and then laravel 8 happened
@VijayKumar-rv2mw
@VijayKumar-rv2mw 4 жыл бұрын
So helpful. Thank you.
@RANJEETKUMAR-wz4dg
@RANJEETKUMAR-wz4dg 3 жыл бұрын
thanks
Junior Code Review: Laravel Routes, Middleware, Validation and more
19:57
Exceptions in Laravel: Why/How to Use and Create Your Own
12:18
Laravel Daily
Рет қаралды 87 М.
Electric Flying Bird with Hanging Wire Automatic for Ceiling Parrot
00:15
У ГОРДЕЯ ПОЖАР в ОФИСЕ!
01:01
Дима Гордей
Рет қаралды 8 МЛН
Остановили аттракцион из-за дочки!
00:42
Victoria Portfolio
Рет қаралды 3,3 МЛН
Laravel Roles and Permissions: All CORE Things You Need To Know
16:32
Laravel Daily
Рет қаралды 221 М.
Eloquent Observers or Events Listeners? Which is Better?
8:24
Laravel Daily
Рет қаралды 60 М.
From Laravel Blade to Vue.js + API [Live-coding Example]
22:28
Laravel Daily
Рет қаралды 168 М.
Laravel Pivot Tables: Simple to Advanced Many-to-Many
12:24
Laravel Daily
Рет қаралды 120 М.
10+ Carbon DateTime "Tricks" You May Not Know
11:01
Laravel Daily
Рет қаралды 27 М.
[Live-Coding] Refactor Laravel Controller to be Much Shorter
14:55
Laravel Daily
Рет қаралды 77 М.
Optimizing Eloquent: Running Out Of Memory?
6:11
Laravel Daily
Рет қаралды 43 М.
No, Einstein Didn’t Solve the Biggest Problem in Physics
8:04
Sabine Hossenfelder
Рет қаралды 295 М.
4 Packages You Need in ANY Laravel Project
8:14
Laravel Daily
Рет қаралды 61 М.
Electric Flying Bird with Hanging Wire Automatic for Ceiling Parrot
00:15