Laravel guide to use database for cache to store dialog states between requests #27
dimaodnokoz
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When you setup new Laravel project, some built-in (box) migrations files are added. There is one for cache table among them.

At this step there are no tables in db or somewhere else, it's just mirations files in database/migrations folder

Laravel configuration allows cache to be stored in the database. For that to happen, you must first set up a database. You can configure your database in your .env file at the root of your project.
Then you need to create your_db_name on your mysql server. Run the following commands in the shell:
You should see - the db is empty.
Next, you will need to update the .env file to specify that we want to use the database as a cache driver. Update the value of the CACHE_DRIVER (older Laravel versions) or CACHE_STORE (last Laravel versions) variable in your .env file to database:
Now you can run the migrations to create tables in your database:
And that's it! You now have your Laravel application set up to use a database as a cache driver.
To verify any table structure use command
Beta Was this translation helpful? Give feedback.
All reactions