Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel Artisan Tinker : write command on multiple lines

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

User::whereEmail('[email protected]')
->get()

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

like image 423
DevonDahon Avatar asked Jun 05 '26 02:06

DevonDahon


2 Answers

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

like image 88
1FlyCat Avatar answered Jun 08 '26 01:06

1FlyCat


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

>>> User::whereEmail('[email protected]') \
... -> get()
like image 42
Noman Saleem Avatar answered Jun 07 '26 23:06

Noman Saleem



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!