Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel Eloquent - Prevent returning specific columns

Say I have a table Client and this has some columns. I specifically do not want to send back a few of the columns in the this table when a call is made to the model.

How can I do this?

like image 391
Kousha Avatar asked Sep 12 '25 11:09

Kousha


1 Answers

Oh it's really simple, just add

protected $hidden = array('password');

to your model class! Check out the docs for more info! http://laravel.com/docs/eloquent

like image 89
Igor R. Avatar answered Sep 14 '25 02:09

Igor R.