Reputation: 946
I am wondering how is the best way to store link like route('index') in the database, so if I change the url structure to not edit manually all links in the database.
What is the best practice for doing that on Laravel ?
Thanks !
Upvotes: 0
Views: 210
Reputation: 7499
Instead try to name your routes, use named routes then you can change url whnever you want because routes are referenced by name
Upvotes: 1
Reputation: 1106
wooot don't do this ! The helper "route" is made not to store all routes in database ! so don't store routes in it !
You have to think of your structure before doing anything else, your route file is the base of your app.
Use the "namespace", "prefix" and "name" functions from your Route::class to organize them, but never store it !
Upvotes: 0