Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel artisan tinker - "quiet mode" - don't print query results

How can I store the results of an Eloquent query to a variable in tinker, without printing the results to the console?

For example, when I run $threads = App\Thread::all() I want to only store the results in the variable $threads without seeing all the threads. Is there something like 'quiet mode' in tinker?

like image 944
Amade Avatar asked Feb 09 '18 09:02

Amade


1 Answers

Tinker dumps the output of the last command executed. So a hackish trick to suppress any output is to append a null statement:

>>> $threads = App\Thread::all(); '';
like image 83
Aranya Sen Avatar answered Oct 24 '22 02:10

Aranya Sen