'required|string|max:255', 'company_name' => 'nullable|string|max:255', 'email' => 'required|email|unique:suppliers,email', 'phone' => 'nullable|string|max:20', 'address' => 'nullable|string|max:255', 'city' => 'nullable|string|max:100', 'state' => 'nullable|string|max:100', 'zip_code' => 'nullable|string|max:20', 'contact_person' => 'nullable|string|max:255', 'payment_terms' => 'nullable|string|max:255', 'rating' => 'nullable|numeric|min:0|max:5', 'is_active' => 'boolean', ]; public function save() { $this->validate(); Supplier::create([ 'name' => $this->name, 'company_name' => $this->company_name, 'email' => $this->email, 'phone' => $this->phone, 'address' => $this->address, 'city' => $this->city, 'state' => $this->state, 'zip_code' => $this->zip_code, 'contact_person' => $this->contact_person, 'payment_terms' => $this->payment_terms, 'rating' => $this->rating ?: null, 'is_active' => $this->is_active, ]); session()->flash('success', 'Supplier created successfully!'); return $this->redirect(route('inventory.suppliers.index'), navigate: true); } public function render() { return view('livewire.inventory.suppliers.create'); } }