27 C
Jaipur
Saturday, October 24, 2020

Proper Laravel Route And View Naming Conventions – Linux Hint

Must read

OnePlus Made Rs. 103 Cr From OnePlus 8T Sales in 1 Minute

OnePlus has garnered praise (and many fanboys) for making some of the better and speedier Android flagship phones over the past few years. The...

Pop!_OS 20.10 Released: 5 New Features Of Ubuntu-based Linux Distro

Days after the release of Ubuntu 20.10 “Groovy Gorilla,” along with its seven official flavors, System76 has announced a new Pop!_OS 20.10 Linux distro...

Apple Watch Saved the Life of a 61-Year-Old Man in India

Apple Watch has become the go-to wearable for fitness and health enthusiasts over the past few years. There have been many instances in which...

When it comes to proper route and view naming conventions in Laravel, it is generally acceptable to use resourcePlural.action so here are some examples:

photos.index
photos.create
photos.store
photos.show
photos.edit
photos.update
photos.destroy<

We also have route() helper. Just like the url(), it’s intended to be used in views to simplify linking to a named route. If the route has no parameters, you can simply pass the route name: (route(‘members.index’)) and receive a route string.

If it has parameters, pass them in as an array as the second parameter like we did in this example.

In general, I recommend using route names instead of paths to refer to your routes, and therefore using the route() helper instead of the url() helper. Sometimes it can be a little clumsy – for example, if you are working with multiple subdomains, but it provides an incredible level of flexibility to later change the application’s routing structure without major penalty.

 

Source link

- Advertisement -

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

OnePlus Made Rs. 103 Cr From OnePlus 8T Sales in 1 Minute

OnePlus has garnered praise (and many fanboys) for making some of the better and speedier Android flagship phones over the past few years. The...

Pop!_OS 20.10 Released: 5 New Features Of Ubuntu-based Linux Distro

Days after the release of Ubuntu 20.10 “Groovy Gorilla,” along with its seven official flavors, System76 has announced a new Pop!_OS 20.10 Linux distro...

Apple Watch Saved the Life of a 61-Year-Old Man in India

Apple Watch has become the go-to wearable for fitness and health enthusiasts over the past few years. There have been many instances in which...

Facebook Is Now Trying to Help Connect You with Neighbors

Facebook, apart from improving its existing apps and bringing high-speed internet to rural areas, has started testing a new community-focused feature to bring neighbors...