Month: January 2019

Using View Composer in Laravel

View Composer is commonly used to share some common variables across the multiple views. We can simply check these variables are set or not in the views. If variable is shared to a view then we can access it and process in the view. According to laravel documentation, “View composers are callbacks or class methods ...

Using Faker in Laravel

Introduction Faker is a PHP library that generates fake data. We can use it extensively while testing our laravel application. We can easily populate our database with fake data. After that, we can run the necessary tests for our requirements. Setup Faker package comes along with laravel installation. You can see the composer.json file in ...

Maintenance Mode and Production Mode In laravel

Maintenance mode is a mode in which same error page view will be displayed for all the request sent to the application. This mode is useful when we are making changes in production server. Configuration – Maintenance Mode Laravel official documentation says, When your application is in maintenance mode, a custom view will be displayed ...

How to create custom validation rules in laravel ?

Laravel provides large set of validation rules. We can use these rules while validating the data passed through request. From the official documentation , we can see available validation rules. Available Validation Rules in Laravel Although there are large number of rules, sometime these rules may not sufficient for our requirement and we might need ...

How to create custom helper function in laravel ?

Helper functions are the global functions that are accessible everywhere in the application. Laravel provides elegant way to define functions that are used frequently in a application. After defining a function as helper, we can access it any where inside the application. There are some such builtin functions. We can see those functions in laravel ...