Hello Friends,
I am developing one bidding system. I have one column where bidders name is shown. But in the UI the business logic expects to keep the bidder name hidden or anonymous untill a particular bid is accepted. Once the bid accepted button is clicked the all the bidder name should become visible. Do we have anything of this sort supported in Laravel. To keep the column value hidden or anonymous and show the value only if a certain event takes place?
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();
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community