LogicException: Please make sure the PHP Redis extension is installed and enabled

In case you install Redis with composer require predis/predis, you need to add this line to .env file: REDIS_CLIENT=predis Then clear cache by run this command: php artisan optimize:clear An additional way you can change this line in config/database.php file: From: ‘client’ => env(‘REDIS_CLIENT’, ‘phpredis’), To: ‘client’ => env(‘REDIS_CLIENT’, ‘predis’), Then clear cache by run … Read more

Laravel check if updateOrCreate performed an update

You can figure it out like this: $tourist = Tourist::updateOrCreate([…]); if(!$tourist->wasRecentlyCreated && $tourist->wasChanged()){ // updateOrCreate performed an update } if(!$tourist->wasRecentlyCreated && !$tourist->wasChanged()){ // updateOrCreate performed nothing, row did not change } if($tourist->wasRecentlyCreated){ // updateOrCreate performed create } Remarks From Laravel 5.5 upwards you can check if updates have actually taken place with the wasChanged and … Read more