hiding data in livewire? backend/Admin Vs customer, dynamically hiding?
so I am testing livewire and if i have a model and in component I do Model::all(); it will pass all the data to the view.
I can use protected $hidden = ['property']; in the model and this does HIDE the properties. BUT this is not very dynamic, for example in a customer facing if i do Model::all() vs admin/backend where i do Model::all(), i may not need to show property to customer but would need to show it to admin?
@Snapey thanks, i did try that and to me that seems a bit messy as i need to loop over the query results/collection and remove the data VS say using API Resources or maybe do a Query and use the columns in the get() method but then i'll have to do that everywhere.. :/
maybe the render method can use a 'an external class method' to do this so i dont have to repeat the logic. everywhere i need it ?