Tuesday, 15 April 2014

php - Extending core Laravel 5 functionality -


The question is quite simple - can any lurewell 5 functionality be extended in any smart way or will you have to copy Required

Because it is quite broad, I give you 2 examples.

1) I would like to change the URL for Edit \ illuminate \ routing \ ResourceRegistrar for and create . At the moment I have found the only way to get it: To pass the main lightening application to your routing service provider />, then increase the expansion of the router , Then expand publish \ routing \ ResourceRegistrar and finally bootstrap / app.php use our expanded application class to replace just 2 lines, many amendments many Ways To Really Share Our Custom Class The code which is replicated to pass is accurate, apart from it uses the square from the other namespace

2) Other similar changes - Set the custom path for the cache config - you can expand it again Required to change the application override method getCachedConfigPath and then bootstrap / app.php

then The question is - the way in which some modifications should be done or may be the same (for example those 2 o Any way the core application class can not be extended and so many changes can be made?

You overwrite the core ResourceRegistrar by binding your own implementation to the service container Should be able to:

  $ this-> App- & gt; Tie ('\ Roshaning \ Routing \ Resourcerigestor', function () {New MyResourceRegistrar ();}); Increase the   

command main ResourceRegistrar and you should be able to overwrite the edit and < / Code> Methods:

  class expands MyResourceRegistrar \ Roshaning \ routing \ ResourceRegistrar {// your methods overwrite here}  

No comments:

Post a Comment