Manipulate & Verify Data Quickly Using Laravel Tinker

As developers, the terminal is our home and we can get, verify and manipulate several forms of data from there.

Imagine a situation where you want to easily verify the data from your Model methods quickly or you want to ascertain the return data of a function in your Controller, you don’t have to open your browser and do all of that.

Laravel provides us with a command line utility to work with our app.

Simple. Just run php artisan tinker: :smile:

It activates a console within your terminal like Rails IRB, then you can do whatever you want.

Let’s see an example:

Get all the users from the users table.

var_dump the content of User Model

Get the list of all the column names in the user table

Take full advantage of Laravel Tinker, it can make your work really fast!

Let me know if you have any thoughts about this in the comment section.



Food Ninja, Code Slinger, Technical Trainer, Accidental Writer, Open Source Advocate and Developer Evangelist.