Support the ongoing development of →
posted 9 years ago
Last updated 2 years ago.

well I know some frameworks have shortcuts like this built in.. but overall laravel is supposed to make for a rapid application. You cannot compare one feature with another.. you have to compare the overall product.

There are so many features in laravel that CI doesnt have plus on top CI is still stuck in dark ages :p


@shez1983 Actually it's a shortcut in Laravel, but it doesn't really matter, let's forget about it :) I'd like to know what are the benefits of using Route::get/post etc for every single controller and action in comparison to Codeigniter.

And yes, I know CI is stuck in dark ages:) That's why I'm slowly learning Laravel.


It's a good question.

I know when Kohana started using explicit routes, it was done in the name of clarity; you can read the routes file and get a feel for the app, as well as disabling routes, or in larger applications, changing routes. Named routes in Laravel should also help to decouple routes from methods as an application grows (though I've not yet built an app big enough to warrant this). I guess one of the major use cases as well, is that it helps to stop people hacking your application - you can conditionally define routes depending on application / user state.

There's nothing to stop you writing code that maps arbitrary routes to controllers though (it's all PHP).

I use the following setup to quickly-and-dirtily route URLs to methods, specifically for testing out PHP functionality in development:

Hope that helps.


Last updated 9 years ago.

The shortcut is


And Laravel handles get/post data the same way using the equivalent of $_REQUEST instead of $_GET or $_POST so no matter what method you use, the data will always be accessible using get (even if the method is post):


The benefit to using post or get in your route would be more for APIs and further determining what action that should happen--effectively just another level of granularity/detail where Laravel does the (not-so in this case) heavy lifting for you. I've also found the ajax method very useful to determine if a page is being loaded into a div on a page or loaded as a standalone page.

if (Request::ajax()) { 
    //do something 

@davestewart - thanks for the link, look like this is what I was looking for, although IMHO it would be much better if it was built-in...

@jeremybalog Re: The shortcut is Route::any('blog_post')

OK, but is there any way to make a route, using any request method, and to any action, without using any external classes like the one from @dacesteward? So I could compress this to one line:




OK, nevermind, thank you everybody.


I've an updated version of that code which handles all HTTP verbs, I'll update the trick in the next day or so.


Sign in to participate in this thread!


Your banner here too?


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.