57 lines
1.3 KiB
PHP
57 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
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
|
|
{
|
|
use HasFactory, HasUuids;
|
|
|
|
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',
|
|
];
|
|
}
|
|
}
|