December 7, 2016 —John Koster
The dump
command can be used to display information about a particular variable or class instance within the console window. It will display the information using Symfony's VarDumper console component:
1PHP Fatal error: Class 'User' not found in eval()'d code on line 12>>> $user = new App\User;3=> App\User {#651}4>>> dump $user5App\User {#651}6>>>
It also import to note that since the Tinker REPL is responding to commands within the context of a Laravel application, the dd
helper function is also available, if its output proves useful:
1>>> dd($user) 2App\User {#651 3 #fillable: array:3 [ 4 0 => "name" 5 1 => "email" 6 2 => "password" 7 ] 8 #hidden: array:2 [ 9 0 => "password"10 1 => "remember_token"11 ]12 #connection: null13 #table: null14 #primaryKey: "id"15 #keyType: "int"16 #perPage: 1517 +incrementing: true18 +timestamps: true19 #attributes: []20 #original: []21 #relations: []22 #visible: []23 #appends: []24 #guarded: array:1 [25 0 => "*"26 ]27 #dates: []28 #dateFormat: null29 #casts: []30 #touches: []31 #observables: []32 #with: []33 #morphClass: null34 +exists: false35 +wasRecentlyCreated: false36}
∎
The following amazing people help support this site and my open source projects ♥️
If you're interesting in supporting my work and want to show up on this list, check out my GitHub Sponsors Profile.