['required', 'string', 'max:255'], 'company_cert_number' => ['required', 'string', 'max:100', 'unique:users,company_cert_number'], 'contact_person_name' => ['required', 'string', 'max:255'], 'contact_person_id' => ['required', 'string', 'max:50'], 'email' => ['required', 'email', 'max:255', 'unique:users,email'], 'phone' => ['required', 'string', 'max:20'], 'password' => ['required', 'string', 'min:8'], 'preferred_language' => ['required', 'in:ar,en'], ]; } public function messages(): array { return [ 'company_cert_number.unique' => __('clients.registration_number_exists'), 'email.unique' => __('clients.email_exists'), ]; } public function create(): void { $validated = $this->validate(); $user = User::create([ 'user_type' => UserType::Company, 'full_name' => $validated['company_name'], 'company_name' => $validated['company_name'], 'company_cert_number' => $validated['company_cert_number'], 'contact_person_name' => $validated['contact_person_name'], 'contact_person_id' => $validated['contact_person_id'], 'email' => $validated['email'], 'phone' => $validated['phone'], 'password' => Hash::make($validated['password']), 'preferred_language' => $validated['preferred_language'], 'status' => UserStatus::Active, ]); AdminLog::create([ 'admin_id' => auth()->id(), 'action' => 'create', 'target_type' => 'user', 'target_id' => $user->id, 'new_values' => $user->only(['company_name', 'email', 'company_cert_number', 'contact_person_name', 'phone', 'preferred_language']), 'ip_address' => request()->ip(), 'created_at' => now(), ]); session()->flash('success', __('clients.company_created')); $this->redirect(route('admin.clients.company.index'), navigate: true); } }; ?>
{{ __('clients.back_to_companies') }}
{{ __('clients.create_company') }} {{ __('clients.company_clients') }}
{{ __('clients.company_name') }} * {{ __('clients.registration_number') }} * {{ __('clients.contact_person_name') }} * {{ __('clients.contact_person_id') }} * {{ __('clients.email') }} * {{ __('clients.phone') }} * {{ __('clients.password') }} * {{ __('clients.preferred_language') }} * {{ __('clients.arabic') }} {{ __('clients.english') }}
{{ __('clients.cancel') }} {{ __('clients.create') }}