user3127109
user3127109

Reputation: 3763

How to get rid of extra values using eloquent in laravel?

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

Answers (1)

Stromgren
Stromgren

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

Related Questions