Laravel Tricks

Browse latest tricks and tips on Laravel.

Laravel migration change column type

How to change column type in Laravel MigrationIn this trick we will see how to change column data type for example we are going to change a field from varchar to longText. To do th ...
published on : 1 hour ago 12 Comments

Using multiple Where clause Query in Laravel.

How to Create Multiple Where Clause Query Using Laravel Eloquent?Simply add an array of condition in where function of laravel Eloquent to create multiple where clause.Here is an e ...
published on : 3 hours ago 12 Comments

Image Manipulation in Laravel 5

An introduction to Intervention ImageIntervention Image is an open source PHP library for image handling and manipulation.Intervention image provides image cropping, editing, compo ...
published on : 1 hour ago 12 Comments

Laravel get ip address

How can we get the IP address of the user in LaravelHello friend in this post I going to show you how to get users IP address in Laravel 5.8 and save it is database.Different Metho ...
published on : 1 hour ago 12 Comments

findorFail method in Laravel

How to use findOrFail() method?Sometimes you may wish to throw an exception if a specific record is not found. To do this, you may use the findOrFail method in Laravel findOrFail m ...
published on : 1 hour ago 12 Comments

Step by step guide to display wordpress posts in Laravel 5

Fetching WordPress posts in LaravelSometimes we have two different databases in our application one for Laravel and other for WordPress to manage our website blog.In this post, we ...
published on : 7 hours ago 12 Comments

Installing specific version of Laravel with Composer

How to Install specific version of Laravel.To install specific version of Laravel please run below command on your terminalcomposer create-project laravel/laravel=version-to-instal ...
published on : 47 minutes ago 12 Comments

DB prefix in Lumen Framework.

How to use db prefix in Lumen? To use db prefix in Lumen, In your .env file add new constant “DB_PREFIX”Usage: DB_PREFIX=your_prefix_ ...
published on : 1 hour ago 12 Comments

Ajax code to delete file in laravel

Deleting a file from public directory in LaravelBelow is a simple code to unlink a file in laravel.AJAX Code in your view filevar CSRF_TOKEN  =  "{{csrf_token()}}"; var ...
published on : 1 hour ago 12 Comments

Class ‘DB’ not found in Lumen

Fixing Class 'DB' not foundBy defaults Facades are not enabled in Lumen, To use DB Facade functions un-comment $app->withFacades(); line from your bootstrap/app.php file. ...
published on : 9 hours ago 12 Comments