vendorRepo = $vendorRepo; } public function ping() { $headers = Utils::getApiHeaders(); return Response::make('', 200, $headers); } /** * @SWG\Get( * path="/vendors", * summary="List of vendors", * tags={"vendor"}, * @SWG\Response( * response=200, * description="A list with vendors", * @SWG\Schema(type="array", @SWG\Items(ref="#/definitions/Vendor")) * ), * @SWG\Response( * response="default", * description="an ""unexpected"" error" * ) * ) */ public function index() { $vendors = Vendor::scope() ->with($this->getIncluded()) ->orderBy('created_at', 'desc') ->paginate(); $transformer = new VendorTransformer(Auth::user()->account, Input::get('serializer')); $paginator = Vendor::scope()->paginate(); $data = $this->createCollection($vendors, $transformer, ENTITY_VENDOR, $paginator); return $this->response($data); } /** * @SWG\Post( * path="/vendors", * tags={"vendor"}, * summary="Create a vendor", * @SWG\Parameter( * in="body", * name="body", * @SWG\Schema(ref="#/definitions/Vendor") * ), * @SWG\Response( * response=200, * description="New vendor", * @SWG\Schema(type="object", @SWG\Items(ref="#/definitions/Vendor")) * ), * @SWG\Response( * response="default", * description="an ""unexpected"" error" * ) * ) */ public function store(CreateVendorRequest $request) { $vendor = $this->vendorRepo->save($request->input()); $vendor = Vendor::scope($vendor->public_id) ->with('country', 'vendorcontacts', 'industry', 'size', 'currency') ->first(); $transformer = new VendorTransformer(Auth::user()->account, Input::get('serializer')); $data = $this->createItem($vendor, $transformer, ENTITY_VENDOR); return $this->response($data); } }