/** * Update the specified resource in storage. * * @param int $id * @param Request $request * @return Response */ public function update(Request $request, $id) { $customer = Customer::findOrFail($id); $customer->firstname = $request->input("firstname"); $customer->lastname = $request->input("lastname"); $customer->gender = $request->input("gender"); $customer->email = $request->input("email"); $customer->phonenumber = $request->input("phonenumber"); $customer->password = HASH::make($request->input("password")); $customer->save(); return redirect()->route('customers.index')->with('message', 'Item updated successfully.'); }
public function registration($number, $password, $tegramId) { $user = Merchant::where('phonenumber', '=', $number)->first(); if (!is_null($user) && HASH::check($password, $user->password)) { $user->chat_id = $tegramId; if ($user->save()) { $reponse = []; $reponse['status_code'] = "200"; $reponse['state'] = "true"; $reponse['message'] = "registration was successful"; return $reponse; } else { $reponse = []; $reponse['status_code'] = "400"; $reponse['state'] = "false"; $reponse['message'] = "Something snapped"; return $reponse; } } else { $reponse = []; $reponse['status_code'] = "400"; $reponse['state'] = "false"; $reponse['message'] = "registration failed"; return $reponse; } }