From 3e3cde2e1e0d3ab158ec71dced43220dc73f2c71 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 3 Oct 2019 13:23:00 +1000 Subject: [PATCH] pdate --- .../Controllers/CompanyGatewayController.php | 156 ++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 app/Http/Controllers/CompanyGatewayController.php diff --git a/app/Http/Controllers/CompanyGatewayController.php b/app/Http/Controllers/CompanyGatewayController.php new file mode 100644 index 0000000000..08b0b9ce21 --- /dev/null +++ b/app/Http/Controllers/CompanyGatewayController.php @@ -0,0 +1,156 @@ +company_repo = $company_repo; + + } + + /** + * Display a listing of the resource. + * + * @return \Illuminate\Http\Response + */ + public function index() + { + $company_gateways = CompanyGateway::whereCompanyId(auth()->user()->company()->id); + + return $this->listResponse($company_gateways); + + } + + /** + * Show the form for creating a new resource. + * + * @return \Illuminate\Http\Response + */ + public function create(CreateCompanyGatewayRequest $request) + { + + $company_gateway = CompanyGatewayFactory::create(auth()->user()->company()->id, auth()->user()->id); + + return $this->itemResponse($company_gateway); + } + + /** + * Store a newly created resource in storage. + * + * @param \App\Http\Requests\SignupRequest $request + * @return \Illuminate\Http\Response + */ + public function store(StoreCompanyGatewayRequest $request) + { + + $company_gateway = CompanyGatewayFactory::create(auth()->user()->company()->id, auth()->user()->id); + $company_gateway->fill($request->all()); + $company_gateway->save(); + + return $this->itemResponse($company_gateway); + + } + + /** + * Display the specified resource. + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function show(ShowCompanyGatewayRequest $request, CompanyGateway $company_gateway) + { + + return $this->itemResponse($company_gateway); + + } + + /** + * Show the form for editing the specified resource. + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function edit(EditCompanyGatewayRequest $request, CompanyGateway $company_gateway) + { + + return $this->itemResponse($company_gateway); + + } + + /** + * Update the specified resource in storage. + * + * @param \Illuminate\Http\Request $request + * @param int $id + * @return \Illuminate\Http\Response + */ + public function update(UpdateCompanyGatewayRequest $request, CompanyGateway $company_gateway) + { + + $company_gateway->fill($request->all()); + $company_gateway->save(); + + return $this->itemResponse($company_gateway); + } + + /** + * Remove the specified resource from storage. + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function destroy(DestroyCompanyGatewayRequest $request, CompanyGateway $company_gateway) + { + + $company_gateway->delete(); + + return response()->json([], 200); + + } +}