如何根据订阅状态显示所有用户,比如在列表中首先显示所有高级用户,然后显示黄金、白银、免费用户等?
User::with('subscriptions')->get(); // List of all users with subscriptions.
// Users Model
public function subscriptions()
{
return $this->hasMany('App\Subscription');
}
// View
@foreach($users as $user)
{{ $user->name }}
@endoreach
四季花海