] * @since [v4.0] * @return View */ public function index(Request $request) { $actionlogs = Actionlog::with('item', 'user', 'target'); //$activitylogs = $activitylogs->Company::scopeCompanyables($activitylogs); if ($request->has('search')) { $actionlogs = $actionlogs->TextSearch(e($request->input('search'))); } $allowed_columns = ['created_at']; $sort = in_array($request->input('sort'), $allowed_columns) ? e($request->input('sort')) : 'created_at'; $order = $request->input('order') === 'asc' ? 'asc' : 'desc'; $offset = request('offset', 0); $limit = request('limit', 50); $total = $actionlogs->count(); $actionlogs = $actionlogs->orderBy($sort, $order); $actionlogs = $actionlogs->skip($offset)->take($limit)->get(); return (new ActionlogsTransformer)->transformActionlogs($actionlogs, $total); } }