1 year ago

Eloquent Select Default Columns

Posted 1 year ago by sehmbimanvir

I have a User Model with columns id, name, email, uuid, password,address,state,city,timestamps

What i am doing is

User::select('id', 'name', 'email', 'uuid')->find(1);


Now the problem is that every time i am querying on this model i have to specify columns because i don't need other columns (in most cases).


Is there any method by which i can select columns by default. So that every time when i call user model it will load basic columns id, name, email, uuid automatically. ?

Please sign in or create an account to participate in this conversation.