public function index(Manager $fractal, AgentTransformer $agentTransformer) { // show all $records = Agent::with('agency')->get(); $collection = new Collection($records, $agentTransformer); $data = $fractal->createData($collection)->toArray(); return $this->respond($data); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { return Agent::with('attachments')->findOrFail($id); }