Can I run a command in Laravel Tinker within just one entry in the CLI?

Viewed 1959

I want to start using tinker to debug functions much faster. The issue is that for every change I need to stop and start tinker again.

I'm hoping I can use something like you have with mysql; you can start mysql and do your queries like that, but you can also run something like this mysql -u root -e "select * from users" which just works without starting up the mysql interface.

So I'm trying to find a way to do something like this

> tinker -e "User::find(1)->email"
"my.user@gmail.com"
>
1 Answers

you can use this php artisan tinker --execute='User::find(3)'
Or execute this php artisan tinker -h if you want to see more options

Related