1. Go to this page and download the library: Download steelants/livewire-form library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
steelants / livewire-form example snippets
namespace App\Livewire\PersonChild;
use App\Models\PersonChild;
use SteelAnts\LivewireForm\Livewire\FormComponent;
use SteelAnts\LivewireForm\Traits\HasModel;
class Form extends FormComponent
{
use HasModel;
public $class = PersonChild::class;
//default rules generated from $fillables of model or define own if you are not using them HasModel Attribute
protected function rules()
{
return [
'properties.name' => '
namespace App\Livewire\User;
use App\Models\User;
use SteelAnts\LivewireForm\Livewire\FormComponent;
use SteelAnts\LivewireForm\Traits\HasModel;
class Form extends FormComponent
{
use HasModel;
public $class = User::class;
protected function rules()
{
return [
'properties.name' => 'rd',
];
}
//Oweride default labels generated from $fillables of model or define own if you are not using them HasModel Attribute
function labels(){
return [
'name' => __('Name'),
'email' => __('Email'),
'password' => __('Password'),
'password_confirmation' => __('Password confirmation')
];
}
function onSuccess(){
//DO SOMETHING ON SUCESS;
}
function onError(){
//DO SOMETHING ON ERROR;
}
}