Menu

## StateForm extends Component
in package
uses LivewireAlert

StateForm.php : 27

Class StateForm

Livewire component responsible for creating and updating state records in the Admin Settings section.

This component handles:

- State creation
- State editing
- Country selection
- Form validation
- Success alerts

### Table of Contents

#### Properties

$country : int|string|null
  Selected country ID.
$name : string|null
  State name.
$stateEditId : int|string|null
  State ID used for edit mode.
$status : int|string|null
  State status (active/inactive).

#### Methods

mount() : void
  Lifecycle hook executed when the component is mounted.
render() : View
  Render the Livewire component view.
submitState() : RedirectResponse
  Handle state form submission.

### Properties

#### $country

StateForm.php : 36

Selected country ID.

`public int|string|null $country`

##### Attributes

#[Rule]
  'required'

#### $name

StateForm.php : 44

State name.

`public string|null $name`

##### Attributes

#[Rule]
  'required'

#### $stateEditId

StateForm.php : 60

State ID used for edit mode.

`public int|string|null $stateEditId`

#### $status

StateForm.php : 52

State status (active/inactive).

`public int|string|null $status`

##### Attributes

#[Rule]
  'required'

### Methods

#### mount()

StateForm.php : 71

Lifecycle hook executed when the component is mounted.

`public mount(int|string|null $id) : void`

Loads state details for edit mode and populates form fields accordingly.

##### Parameters

$id : int|string|null

  State ID

#### render()

StateForm.php : 122

Render the Livewire component view.

`public render() : View`

Loads country list for state form and displays the create/edit form.

##### Return values

View

#### submitState()

StateForm.php : 93

Handle state form submission.

`public submitState() : RedirectResponse`

Validates input data and performs:

- State update (if editing)
- State creation (if new)

Displays success alerts and redirects back to the states listing page.

##### Return values

RedirectResponse

## Search results