Search code examples
phplaravellaravel-5laravel-5.5laravel-artisan

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?


Solution

  • 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(); '';