validate([ 'name' => ['required', 'string', 'max:255'], 'username' => ['required', 'string', 'max:255', Rule::unique('users')->ignore($account->id)], 'mobile' => ['required', 'regex:/^09\d{9}$/', 'digits:11', 'numeric'], 'email' => ['required', 'string', 'email', 'max:255'], 'two_factor_status' => ['required', 'in:off,sms,email'], ]); DB::beginTransaction(); try { $account->update($data); DB::commit(); alert()->success('با موفقیت بروزرسانی شد.')->persistent('باشه'); } catch (\Exception $e) { DB::rollBack(); alert()->warning('بروزرسانی با خطا مواجه شد.')->persistent('باشه'); } return back(); } }