php - Laravel - Overriding a resource route into a different route filter group -


Does Laravel's routing work as expected? What I think, if I want to override a route, then I just have to give the expected route before each other.

I have something like this:

 root :: group (array ('first' = & gt; 'defaultLoads' =); function () {root :: post 'Newsletter', 'newsletter controller @ store'); root: group (array ('(newsletter', 'newsletter controller');}});  

That if I post this route, only http://domain.com/newsletter should run only the default loads route filter.

However, when I call php Runs artisan routes , I get this:

| | POST newsletter | newsletter.store | newslettercontroller@ store | default loads | login | |

though it reads the route correctly (PHP artisan loads which The correct path is to the right place) but the file of the resource path even if it is not in the filter group, the path is affected.

Then my question:

  1. < P> How does it work Laravel?

  2. If so, do I post this -> Newsletters Root is actually possible to override without following?

      Root :: Groups (array ('first' & gt; 'default loads'), function () {root :: post ('newsletter', 'newsletter controller @ store'); Root :: Group (Array ('first' = & gt; 'login'), function () {root :: find ('newsletter', 'newsletter controller @ gate'); root :: find ('newsletter / } ',' Newsletter controller @ show '); // except for all routes except all posts}}}; actually works in case of override like this, where  

You need to override the actual route that is being matched. For example, when you have a parameter One route must be overridden, with some hardening something:

  get the root: ('newsletter / custom', ...); route :: find ('newsletter / { Ultimate} ', ...); // This is overridden by the first route  

However, the definitions of your route are the same (both from newsletter to post code> request). This means that the last one will override the first one (and any filter applied to it in the current context) for the last time. Then you should overdue it after the resource route definition:

  Root :: Groups (array ('first' = 'gt;' defaultLoads'), function ( ) (Root: 'group' ('first' = 'gt;' login '), function () {root :: processing (' newsletter ',' newsletter controller ');} root: post (' newsletter ' 'NewslettersController @ Store');});  

Your Artisan Routes For now, it should now look like:

  Post newsletter Newsletter controller @ store | | DefO T loads  

Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -