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() ->withTrashed() ->orderBy('created_at', 'desc'); return $this->listResponse($vendors); } /** * @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(); return $this->itemResponse($vendor); } }