public function getDealers($code) { $brand = Brand::whereBrandCode($code)->first(); $dealerIds = $brand->users()->lists('user_id')->toArray(); $users = User::with('profile')->whereIn('id', $dealerIds)->get(); return \Fractal::collection($users, new UserTransformer())->getArray(); }
public function getPaginate() { $take = 40; return User::with(['entity' => function ($q) use($take) { $q->take($take); $q->orderBy('created_at', 'DESC'); }, 'town', 'organization'])->paginate(8); }
public function index() { $users = User::with('profile')->latest()->simplePaginate(20); return view('users.lists')->with(compact('users')); }