9

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"
>
iosifv
  • 1,153
  • 1
  • 10
  • 26

1 Answers1

11

You can use: php artisan tinker --execute="dump(User::find(1)->email)" which you can write a little bit shorter to be php artisan tinker --execute="dd(User::find(1)->email)".

If you want to see more options, execute this: php artisan tinker -h. As you can see there, unfortunately there is no abbreviation for the --execute[=EXECUTE] flag.

Robin Bastiaan
  • 572
  • 2
  • 8
  • 21
viryl15
  • 454
  • 4
  • 9