106 lines
2.3 KiB
PHP
106 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace App\Livewire\Forms;
|
|
|
|
use App\Models\Specimen;
|
|
use Livewire\Attributes\Validate;
|
|
use Livewire\Form;
|
|
|
|
class SpecimenForm extends Form
|
|
{
|
|
#[Validate('required')]
|
|
public string $date = '';
|
|
|
|
#[Validate('required')]
|
|
public string $family = '';
|
|
|
|
#[Validate('required')]
|
|
public string $genus = '';
|
|
|
|
#[Validate('required')]
|
|
public string $specificEpithet = '';
|
|
|
|
#[Validate('required')]
|
|
public string $collector = '';
|
|
|
|
#[Validate('required')]
|
|
public string $collectionNumber = '';
|
|
|
|
public array $associateCollectors = [];
|
|
|
|
#[Validate('required')]
|
|
public string $plantHabit = '';
|
|
|
|
#[Validate('required')]
|
|
public string $populationSize = '';
|
|
|
|
#[Validate('required')]
|
|
public string $substrate = '';
|
|
|
|
#[Validate('required')]
|
|
public string $phenologyFlowering = '';
|
|
|
|
#[Validate('required')]
|
|
public string $phenologyFruiting = '';
|
|
|
|
#[Validate('required')]
|
|
public string $phenologyFruitingFlowering = '';
|
|
|
|
#[Validate('required')]
|
|
public string $phenologyVegetative = '';
|
|
|
|
public string $phenologyNotes = '';
|
|
|
|
#[Validate('required')]
|
|
public string $vegetationCommunity = '';
|
|
|
|
public array $plantAssociates = [];
|
|
|
|
#[Validate('required')]
|
|
public string $aspect = '';
|
|
|
|
#[Validate('required')]
|
|
public string $exposure = '';
|
|
|
|
#[Validate('required')]
|
|
public string $elevation = '';
|
|
|
|
#[Validate('required')]
|
|
public string $location = '';
|
|
|
|
public string $latitude = '';
|
|
|
|
public string $longitude = '';
|
|
|
|
public function store()
|
|
{
|
|
$this->validate();
|
|
|
|
Specimen::create($this->only([
|
|
'date',
|
|
'family',
|
|
'genus',
|
|
'specificEpithet',
|
|
'collector',
|
|
'collectionNumber',
|
|
'associateCollectors',
|
|
'plantHabit',
|
|
'populationSize',
|
|
'substrate',
|
|
'phenologyFlowering',
|
|
'phenologyFruiting',
|
|
'phenologyFruitingFlowering',
|
|
'phenologyVegetative',
|
|
'phenologyNotes',
|
|
'vegetationCommunity',
|
|
'plantAssociates',
|
|
'aspect',
|
|
'exposure',
|
|
'elevation',
|
|
'location',
|
|
'latitude',
|
|
'longitude',
|
|
]));
|
|
}
|
|
}
|