Laravel 5 Create View Helpers Functions

To help us with repetitive tasks like manipulating data for our views and such we can create helper functions to do the dirty work for us. A quick way of doing this is to create a helper class which can be auto loaded by Laravel via the composer.json file. Then we create a static function on our helper class which we can then use directly in our blade templates. Nice one!

This example shows how you can make a function given a string to return the url slug. But your functions can be anything this is just an example.





Sam Deering is a web developer from England (currently living in Australia). In his spare time he enjoys coding, playing chess, reading and investing.

Leave a Reply

Your email address will not be published. Required fields are marked *