rest_paginate( BannerResource::collection( Banner::with('media') ->where('is_visible', true) ->when($request->place, fn ($query, $place) => $query->where('place', $place)) ->when($request->app, fn ($query, $app) => $query->where('app', $app)) ->ordered() ->simplePaginate( perPage: $request->perPage, columns: $request->fields, ) ) ); } }