ditojanelidze
ditojanelidze

Reputation: 90

Laravel console like rails

I have began to study "Laravel". I have already learned ruby on rails framework. Rails have console where you can create models and run all the commands your script runs. It is very useful and i am really used to this. I am interested if "Laravel" has anything like this, to create my objects and check if validations work correctly or run commands like "Post.all" where post is my object to retrieve all data from database.

Upvotes: 1

Views: 1913

Answers (1)

khartnett
khartnett

Reputation: 861

The Rails console is based on Interactive Ruby Shell (IRB) which is a read–eval–print loop (REPL) environment. There is an equivalent in Laravel (based off of psysh):

php artisan tinker

Note that 'Tinker' appears to be included in Laravel 5.7 (current at time of writing), but was removed in some previous versions. It can be installed with these instructions: https://stackoverflow.com/a/41888190/1512654

Upvotes: 3

Related Questions