Felipe Buccioni
Felipe Buccioni

Reputation: 19678

Ignore field to select in Eloquent model

I'm using a database with images as blob data and I want to ignore the "image" field of the table/model by default but be able to use the field later. ¿Is this possible?.

Upvotes: 1

Views: 3060

Answers (1)

The Alpha
The Alpha

Reputation: 146201

You can use this in your model, for example User model:

protected $hidden = array('image');

If you use this:

$model = User::find(1);
dd($model->toArray());

You'll not see the image field but if you use this:

dd($model->image);

Then you'll see that.

Upvotes: 2

Related Questions