芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/myvyralapp.com/bck/app/Http/Controllers/GlobalController.php
validate([ 'country_id' => 'required|integer', ]); $country_id = $request->country_id; // Get All States From Country $country_states = get_country_states($country_id); return response()->json($country_states,200); } public function getCities(Request $request) { $request->validate([ 'state_id' => 'required|integer', ]); $state_id = $request->state_id; $state_cities = get_state_cities($state_id); return response()->json($state_cities,200); // return $state_id; } public function getCountries(Request $request) { $countries = get_all_countries(); return response()->json($countries,200); } public function getTimezones(Request $request) { $timeZones = get_all_timezones(); return response()->json($timeZones,200); } public function userInfo(Request $request) { $validator = Validator::make($request->all(),[ 'text' => "required|string", ]); if($validator->fails()) { return Response::error($validator->errors(),null,400); } $validated = $validator->validate(); $field_name = "email"; // if(check_email($validated['text'])) { // $field_name = "email"; // } try{ $user = User::where('id','!=',auth()->user()->id)->where($field_name,$validated['text'])->first(); // return Response::success($user,200); if($user != null) { if(@$user->address->country === null || @$user->address->country != get_default_currency_name()) { $error = ['error' => ["User Country doesn't match with default currency country"]]; return Response::error($error, null, 500); } } }catch(Exception $e) { $error = ['error' => [$e->getMessage()]]; return Response::error($error,null,500); } $success = ['success' => ['Successfully executed']]; return Response::success($success,$user,200); } /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { // } /** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { // } /** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { // } /** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { // } /** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { // } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { // } /** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { // } }