localeRules = ['locale' => 'required|in:ru,tm,en']; $this->data = $request->only(['locale']); $this->validator = Validator::make($this->data, $this->localeRules); } public function getBankInfo() { if($this->validator->fails()) { return response()->json($this->validator->errors(), 400); } return response()->json([ 'tax_code' => Settings::getValue('tax_code'), 'bab' => Settings::getValue('bab'), 'manat_account' => Settings::getValue('manat_account'), 'correspondent_account' => Settings::getValue('correspondent_account'), 'bank_address' => trans("validation.api.bank_address_one", [], $this->data['locale']) ], 200); } public function getBankTypes() { if($this->validator->fails()) { return response()->json($this->validator->errors(), 400); } $banks = []; $i = 0; foreach (Config::get('bank') as $bank) { $banks[$i]['api_val'] = $bank['api_val']; $banks[$i]['name'] = $bank['trans'][$this->data['locale']]; $i++; } return response()->json($banks, 200); } }