/** * @SWG\Post( * path="/clients", * tags={"client"}, * summary="Create a client", * @SWG\Parameter( * in="body", * name="body", * @SWG\Schema(ref="#/definitions/Client") * ), * @SWG\Response( * response=200, * description="New client", * @SWG\Schema(type="object", @SWG\Items(ref="#/definitions/Client")) * ), * @SWG\Response( * response="default", * description="an ""unexpected"" error" * ) * ) */ public function store(CreateClientRequest $request) { $client = $this->clientRepo->save($request->input()); $client = Client::scope($client->public_id)->with('country', 'contacts', 'industry', 'size', 'currency')->first(); $transformer = new ClientTransformer(Auth::user()->account, Input::get('serializer')); $data = $this->createItem($client, $transformer, ENTITY_CLIENT); return $this->response($data); }
/** * @SWG\Post( * path="/clients", * tags={"client"}, * summary="Create a client", * @SWG\Parameter( * in="body", * name="body", * @SWG\Schema(ref="#/definitions/Client") * ), * @SWG\Response( * response=200, * description="New client", * @SWG\Schema(type="object", @SWG\Items(ref="#/definitions/Client")) * ), * @SWG\Response( * response="default", * description="an ""unexpected"" error" * ) * ) */ public function store(CreateClientRequest $request) { $client = $this->clientRepo->save($request->input()); $client = Client::scope($client->public_id)->with('country', 'contacts', 'industry', 'size', 'currency')->first(); $client = Utils::remapPublicIds([$client]); $response = json_encode($client, JSON_PRETTY_PRINT); $headers = Utils::getApiHeaders(); return Response::make($response, 200, $headers); }
/** * Store a newly created resource in storage. * * @return Response */ public function store(CreateClientRequest $request) { $data = $request->input(); if (!$this->checkUpdatePermission($data, $response)) { return $response; } $client = $this->clientService->save($data); Session::flash('message', trans('texts.created_client')); return redirect()->to($client->getRoute()); }
/** * Store a newly created resource in storage. * * @return Response */ public function store(CreateClientRequest $request) { $client = $this->clientService->save($request->input()); Session::flash('message', trans('texts.created_client')); return redirect()->to($client->getRoute()); }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update($id, CreateClientRequest $request) { $client = Client::findOrFail($id); $client->update($request->all()); $oid = $client->id; $url = 'clients/' . $oid; return redirect($url); }
public function store(CreateClientRequest $request, Client $client) { $client->create($request->all()); return redirect()->route('clients.index'); }
/** * @SWG\Post( * path="/clients", * tags={"client"}, * summary="Create a client", * @SWG\Parameter( * in="body", * name="body", * @SWG\Schema(ref="#/definitions/Client") * ), * @SWG\Response( * response=200, * description="New client", * @SWG\Schema(type="object", @SWG\Items(ref="#/definitions/Client")) * ), * @SWG\Response( * response="default", * description="an ""unexpected"" error" * ) * ) */ public function store(CreateClientRequest $request) { $client = $this->clientRepo->save($request->input()); return $this->itemResponse($client); }