Php Artisan Tinker in Laravel

Tinker command is used to create a connectivity with the database as it allows us to create the objects, insert the data, etc in the database.

To run the tinker command we should execute:

php artisan tinker

To run the tinker command first of all we need to create table in the database through migration command which we have explained in the previous blog. Please refer that for creating tables.

Once we provide the details in the given table we can migrate it to the database by using php artisan migrate command and we can see the columns in our local database.

After migrating we can run the tinker command and insert data in the table using tinker:

php artisan tinker

-Single Row Insertion

-Multi Row Insertion

These commands will insert the data in the database and you can view these details by running the command given below:

To find a particular value from the database run the following command:

To find a particular column from the database run the following command:

Some of the fetch commands of tinker are given below:

To update any value in the table we can follow the command given below:

To delete any value in the table we can follow the command given below:

To delete the entire table we can follow the command given below:

So there are the commands used in tinker, you can also see the detailed video which is given below:

Joydeep M
Latest posts by Joydeep M (see all)
Tagged : /
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x