diff --git a/app/Livewire/Forms/SpecimenForm.php b/app/Livewire/Forms/SpecimenForm.php
new file mode 100644
index 0000000..446352c
--- /dev/null
+++ b/app/Livewire/Forms/SpecimenForm.php
@@ -0,0 +1,105 @@
+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',
+ ]));
+ }
+}
diff --git a/app/Livewire/Herbarium/CreateSpecimen.php b/app/Livewire/Herbarium/CreateSpecimen.php
new file mode 100644
index 0000000..7f9cc22
--- /dev/null
+++ b/app/Livewire/Herbarium/CreateSpecimen.php
@@ -0,0 +1,23 @@
+form->store();
+
+ return $this->redirect('/herbarium/list');
+ }
+}
diff --git a/app/Models/Specimen.php b/app/Models/Specimen.php
index d8d5099..1a26dd2 100644
--- a/app/Models/Specimen.php
+++ b/app/Models/Specimen.php
@@ -5,6 +5,7 @@
use Illuminate\Database\Eloquent\Concerns\HasUuids;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Eloquent\Relations\HasOne;
class Specimen extends Model
{
@@ -13,6 +14,43 @@ class Specimen extends Model
protected $table = 'specimens';
protected $fillable = [
- ''
- ]
+ 'date',
+ 'family',
+ 'genus',
+ 'specific_epithet',
+ 'collector',
+ 'collection_number',
+ 'associate_collectors',
+ 'plant_habit', // herb, vine, shrub, liana, shrub, subshrub, tree
+ 'population_size',
+ 'substrate',
+ 'phenology_flowering',
+ 'phenology_fruiting',
+ 'phenology_fruiting_flowering',
+ 'phenology_notes',
+ 'phenology_vegetative',
+ 'vegetation_community',
+ 'plant_associates',
+ 'aspect',
+ 'exposure',
+ 'elevation',
+ 'location',
+ 'latitude',
+ 'longitude',
+ 'user_id',
+ ];
+
+ public function user(): HasOne
+ {
+ return $this->hasOne(User::class,'id','user_id');
+ }
+
+ protected function casts(): array
+ {
+ return [
+ 'date' => 'date',
+ 'associate_collectors' => 'array',
+ 'plant_associates' => 'array',
+ ];
+ }
}
diff --git a/app/Models/User.php b/app/Models/User.php
index 214bea4..47a6c3a 100644
--- a/app/Models/User.php
+++ b/app/Models/User.php
@@ -4,6 +4,7 @@
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
+use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Illuminate\Support\Str;
@@ -37,6 +38,11 @@ class User extends Authenticatable
'remember_token',
];
+ public function specimens(): HasMany
+ {
+ return $this->hasMany(Specimen::class);
+ }
+
/**
* Get the attributes that should be cast.
*
diff --git a/app/View/Components/Forms/textInput.php b/app/View/Components/Forms/textInput.php
new file mode 100644
index 0000000..cd5bfff
--- /dev/null
+++ b/app/View/Components/Forms/textInput.php
@@ -0,0 +1,26 @@
+