Reputation: 3763
I am getting extra details like follows while using laravel. Like I want to hide guarded, fillable, softdelete, appends, touches, dates, visible, relations etc. How can i hide it or just remove it. I just want to display the results in the array.
Upvotes: 0
Views: 126
Reputation: 1074
Use the toArray() function.
User::all()->toArray();
Array ( [0] => Array ( [id] => 1 [email] => '[email protected]' [password] => 'example' ) [1] => Array ( [id] => 2 [email] => '[email protected] [password] => 'example ))
Upvotes: 2