Laravel Tricks

Browse latest tricks and tips on Laravel.

Getting Random rows in Laravel Eloquent.

How to select random rows in Laravel?Sometime we have to get records from database in random order, here I am going to show some ways to get / select random records from database i ...
published on : 12 hours ago 12 Comments

How to enable maintenance mode in Laravel 5?

You can enable maintenance mode in Laravel 5, simply by executing below command.//To enable maintenance mode php artisan down //To disable maintenance mode php artisan up ...
published on : 9 hours ago 12 Comments

Service providers in Laravel

What are service providers in Laravel?Service providers are the central place of all Laravel application bootstrapping. Your own application, as well as all of Laravel’s core ser ...
published on : 3 days ago 12 Comments

List some official packages provided by Laravel.

Below are some official packages provided by LaravelDusk: Laravel Dusk provides an expressive, easy-to-use browser automation and testing API. By default, Dusk does not require you ...
published on : 11 hours ago 12 Comments

Laravel get data from database by id.

How to get a record in Laravel by id?Use laravel Eloquent find() method toi get a record by id in Laravel below is sample usage:YourModal::find($id); You can also use first method ...
published on : 1 hour ago 12 Comments

Creating zip of multiple files and download in Laravel.

How to zip multiple files and download in Laravel?Use Zipper package by Chumper to zip files in laravel.Install Chumper/Zipper package and add below function in your controlle ...
published on : 16 hours ago 12 Comments

How to create zip files in Laravel?

In this tutorial we are going to see how to create zip files in Laravel Framework.We are going to use zanysoft/laravel-zip package for file compression and backup. was zanysoft/lar ...
published on : 11 minutes ago 12 Comments

Where not in Laravel

How to use where not in clause in Laravel?WhereNotIn method of laravel db builder and Eloquent is used to select records that are not in given array.Where not in ExamplewhereNotIn ...
published on : 3 hours ago 12 Comments

Laravel get server ip

How to get the server IP with Laravel?Use below code to get IP address server in Laravel.request()->server('SERVER_ADDR'); You can also use old php way to get server ip by $_SE ...
published on : 16 minutes ago 12 Comments

Laravel phone number validation

How to validate phone number in Laravel Framework?Laravel did not provide any inbuilt validation method for validating phone no. The only way to validate phone no in laravel is thr ...
published on : 2 hours ago 12 Comments