You can simply use YourModel::all(); to select all records from table with Laravel Eloquent.Example Usage$posts= Post::all();
$posts->each(function($post){
//do ...
How to resolve sqlstate hy000 error 2002 in laravel.This type of error is occurred due to wrong database configration in .env file. Steps to resolve sqlstate hy000 error in Larave ...
How to delete a migration file in Laravel?Sometime we accidentally create a migration in laravel later we identify the particular migration is not required. In this post I am going ...
php artisan optimize is used to remove the boostrap/cache/ directory files and recreates it.From Laravel 5.5 php artisan optimize commnad is removed and no longer needed. ...
Laravel's clear-compiled is an artisan command to clear the compiled classes and services.To clear compiled classes in Laravel please run below command. php artisan clear-comp ...
Initialization function is also known as constructor in PHP. The constructor is also a normal function, but it has a special feature that is always called when we initialize an obj ...
When AUTO_INCREMENT reaches the maximum value in MysqlIf the AUTO_INCREMENT column allows only unique values ??such as a primary key? An error occurs due to duplication (unique con ...
How to disable error handler in Laravel framework?You can disable error and warning handler in Laravel by simply setting 'debug' => false in your config/app.php ...
How to use order By clause in Laravel?Order by is used to sort sql results by column names. In this example we will see how to add multiple orderby clause in Laravel.Let take an ex ...
Setting and getting cookie in LaravelHi Guys, in this post we are going to see how to read and write cookies in Laravel 5.8. In Laravel all cookies are encrypted and signed with an ...