behaviorRepository = $behaviorRepository; } /** * 行为列表 */ public function index(Request $request) { $behavior_list = $this->behaviorRepository->index($request->all()); if ($behavior_list){ return $behavior_list; }else{ return '没有找到对应行为列表'; } $fractal = new Manager(); $resource = new Collection($behavior_list, new BehaviorTransformer()); $resource->setPaginator(new IlluminatePaginatorAdapter($behavior_list)); $data = $fractal->createData($resource)->toArray(); $data['extra'] = [ 'filters' => [ '_id', 'behavior_name', ], 'columns' => [ '_id', 'behavior_name', ] ]; return $data; } }