/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(ClientsFormRequest $request, $id) { $slug = uniqid(); $file = $request->file('client_logo_update'); if (empty($file)) { $file_text = $request->get('client_logo'); } else { unlink('uploads/' . $request->get('client_logo')); $file->move('uploads/', $slug . '__' . $file->getClientOriginalName()); $file_text = $slug . '__' . $file->getClientOriginalName(); } $client = Client::whereId($id)->firstOrFail(); $client->client_name = $request->get('client_name'); $client->client_email = $request->get('client_email'); $client->client_phone_number = $request->get('client_phone_number'); $client->client_address = $request->get('client_address'); $client->client_logo = $file_text; $client->save(); return redirect('admin/clients'); }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(ClientsFormRequest $request, $id) { $client = Client::whereId($id)->firstOrFail(); $client->client_name = $request->get('client_name'); $client->client_email = $request->get('client_email'); $client->client_phone_number = $request->get('client_phone_number'); $client->client_address = $request->get('client_address'); $client->save(); return redirect('clients'); }