Is it possible to add some prefix to the entire application, including blades, URLs and links? For example, I have a route
Route: find ('/', 'Home Welcome To Controller'); but instead I want to get the
Route: ($ prefix '/', 'Home Controller @ ShowWalm'); and in blade
{{HTML :: style ('css / bootstrap.min.css')}}
{{HTML :: style ($ prefix. 'Css / bootstrap.min.css')}} I tried
Root :: Groups (array ('prefix' => prefix), function () {}); But it did not apply the prefix for the link in the blade.
I found a simple solution I created a project inside the .env.php folder Which looks like
return array ('ROUTES_PREFIX' = & gt; 'prefix'); Then this code was added to all the routes
root :: group (array ('prefix' = & gt; $ _ENV ['ROUTES_PREFIX'] ), Function () {// routes here}); Custom macro has been created for and I hope someone will find this useful. style , script and image . For example, my macro looks like style
html :: macro ('extended style', function ($ url, $ attributes = array) , $ Secure = Null] {$ prefix = $ _ENV ['ROUTES_PREFIX'] == ''? '': $ _ENV ['ROUTES_PREFIX']. '/'; Return HTML :: style ($ prefix $. Url, $ Attributes, $ safe);});
Comments
Post a Comment