Laravel Tricks

Browse latest tricks and tips on Laravel.

Explain migrations in Laravel? How can you generate migration.

Laravel migrationsLaravel Migrations are like version control for your database, allowing a team to easily modify and share the application’s database schema. Migrations are typi ...
published on : 2 days ago 12 Comments

Disabling timestamps in Laravel Eloquent

How to disable Laravel Eloquent timestamps?Simply add public $timestamps = false; in your model where you want disable timestamps.Example:namespace App; use Illuminate\Database\El ...
published on : 1 day ago 12 Comments

IN query in Laravel Eloquent

How to use "IN" Query in Laravel ?In Laravel you can use "IN" query asUsing Eloquent$data = YourModel::whereIn('id', array(1, 2, 3))->get(); Using DB Query builder$data = DB::t ...
published on : 1 day ago 12 Comments

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 : 1 hour 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 : 1 day 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 : 5 hours 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 : 1 day 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 day 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 : 6 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 : 2 hours ago 12 Comments