Example #1
0
 public function patchUpdate(ClientFormRequest $request, $clientId)
 {
     $client = \App\Client::find($clientId);
     if (!$client) {
         \Flash::error('Client not found');
         return redirect('clients');
     }
     $client->patch($request->all());
     \Flash::success('Client saved.');
     return redirect('clients');
 }
Example #2
0
 /**
  * Update the specified resource in storage.
  * @param ClientFormRequest $request
  * @param $id
  * @return Response
  */
 public function update(ClientFormRequest $request, $id)
 {
     if ($this->client->updateById($id, $request->all())) {
         flash()->success('Client details updated');
         return response()->json(array('success' => true, 'msg' => 'client updated'), 201);
     }
     return response()->json(array('success' => false, 'msg' => 'update failed'), 422);
 }