2

How can I write a command on two lines with Laravel Artisan Tinker ?

User::whereEmail('john.doe@home.com')
->get()

PHP Parse error: Syntax error, unexpected T_OBJECT_OPERATOR on line 1

DevonDahon
  • 7,460
  • 6
  • 69
  • 114
  • Does this answer your question? [How to write in new line with laravel tinker](https://stackoverflow.com/questions/61542285/how-to-write-in-new-line-with-laravel-tinker) – miken32 Mar 03 '23 at 23:39

2 Answers2

9

Use the \ character to force the REPL into multi-line input mode:

>>> User::whereEmail('john.doe@home.com') \
... -> get()
Noman Saleem
  • 421
  • 1
  • 8
6

You can type edit, which launches an external editor and loads the generated code into the input buffer.

1FlyCat
  • 163
  • 2
  • 4