[SOLVED] How can I clear all Laravel cached data when every crud operation?

Issue

I want that all cached data in my Laravel web site be clear and recreate after every crud operation(adding, edit, update and delete) on posts table. how can I do that?

Solution

You can call php artisan command like this after CRUD operations:

script

Artisan::call('cache:clear');

Or you can use Cache facade:

Cache::flush();

For more information Laravel Cache

Answered By – Iftikhor

Answer Checked By – David Goodson (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published.