54 lines
1.0 KiB
PHP
54 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Dcat\Admin\Traits\HasDateTimeFormatter;
|
|
use EloquentFilter\Filterable;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class CropYield extends Model
|
|
{
|
|
use Filterable, HasDateTimeFormatter;
|
|
|
|
protected $casts = [
|
|
'extends' => 'array',
|
|
];
|
|
|
|
protected $fillable = [
|
|
'base_id', 'crop_id', 'time_year', 'yield', 'cultivated', 'output',
|
|
'created_by', 'updated_by',
|
|
'quarter', 'extends',
|
|
'category_id',
|
|
];
|
|
|
|
/**
|
|
* 基地
|
|
*
|
|
* @return void
|
|
*/
|
|
public function base()
|
|
{
|
|
return $this->belongsTo(AgriculturalBase::class, 'base_id');
|
|
}
|
|
|
|
/**
|
|
* 农作物
|
|
*
|
|
* @return void
|
|
*/
|
|
public function crop()
|
|
{
|
|
return $this->belongsTo(Crop::class, 'crop_id');
|
|
}
|
|
|
|
public function createdBy()
|
|
{
|
|
return $this->belongsTo(AdminUser::class, 'created_by');
|
|
}
|
|
|
|
public function updatedBy()
|
|
{
|
|
return $this->belongsTo(AdminUser::class, 'updated_by');
|
|
}
|
|
}
|