Laravel

Run Single Seeder Class in Laravel

Run Single Seeder Class in Laravel

In Laravel if you are looking to run a single seeder class you can do so by running the following command php artisan db:seed --class=PostTableSeeder In the above command, class PostTableSee...

May 10, 2022 · Tushar
Laravel 9 Basic CRUD Operations In-Depth Example

Laravel 9 Basic CRUD Operations In-Depth Example

This article goes in detailed on implementing Laravel CRUD Operations. Create, Read, Update and Delete are the very basic operations that almost every application has. Creating a basic CRUD Operations...

May 05, 2022 · Tushar
Download PDF on external URL via Laraval

Download PDF on external URL via Laraval

If you have the URL of PDF which is situated on some other domain. You can allow it to be downloaded via your laravel application with following code $pdf = file_get_contents('http://www.africau....

Mar 10, 2022 · Tushar
Get count of records created today Laravel

Get count of records created today Laravel

If you are looking to get the total number of records that are created / updated today in the mysql database, then the following Eloquent query will come handy. Considering we have a model named Po...

Mar 09, 2022 · Tushar
Laravel - List all files in public directory

Laravel - List all files in public directory

Laravel's Storage facade makes it easier to get list of files within a directory. However if you are looking to get a list of files within the public directory, or any other directory within the publi...

Dec 13, 2021 · Tushar
Cache laravel query results using file driver for ajax

Cache laravel query results using file driver for ajax

Often in your laravel application you are loading and fetching the results on the database which doesn't necessarily needs to be fetched on every page reload. Query that takes longer amount to execute...

Nov 29, 2021 · Tushar
Add Select 2 package in Laravel using npm

Add Select 2 package in Laravel using npm

There are two ways to include Select2 plugin in your laravel project, one is via including the CDN and another is via NPM i.e. node package manager. I find handling the dependencies via NPM to be a...

Oct 26, 2021 · Tushar
Validate optional fields in Laravel

Validate optional fields in Laravel

At times in your laravel validation, you may want input field to be validated only if the user filled in the field and you may want to skip the validation if there is field is left blank. This can be...

Sep 03, 2021 · Tushar
Tomorrow and Yesterday date using Carbon in PHP Laravel

Tomorrow and Yesterday date using Carbon in PHP Laravel

Using Carbon library it is very simple to get yesterday's and tomorrow's timestamp in your PHP or Laravel code. You just need to import the Carbon library and call below functions Carbon::to...

Aug 30, 2021 · Tushar