/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy(Request $request, $action) { if ($action == 'delete') { $validator = Validator::make($request->all(), ['id' => 'required']); if ($validator->fails()) { return response(array('error' => 'data not valid'), 400); } $data['id'] = $request->input('id'); MsUser::delete_user($data); return response('', 200); } return response(array('error' => 'true'), 404); }
public static function update_user($data) { $hasher = app()->make('hash'); MsUser::where('id', $data['id'])->update(array('email' => $data['email'], 'password' => $hasher->make($data['password']), 'role_id' => $data['role_id'])); }