Support the ongoing development of Laravel.io →
Eloquent Views Forms
Last updated 2 years ago.
0

Hm...I think the only way to do this is except by manually not selecting it when you run your query. For example...

Model::get(['id', 'other_info', 'more_info']);

If you don't want to type out all the select info and you want to make it cleaner, you can create a scope for this. Inside your model, add something like this:

public function scopeAnonymous($query)
{
	return $query->select('id', 'and_other_info_you_want');
}

Then, you can just run this:

Model::anonymous()->get();
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.