If you want to call some fields from a specific table in a more organized way, you can write this function in Model :-
public function scopeDoctorFields($query)
{
$query->select('name');
}
then call function inside Controller :-
$doctors = User::doctorFields()->paginate(100);
Top comments (0)