djc-new/app/Models/Institution.php

38 lines
723 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use EloquentFilter\Filterable;
class Institution extends Model
{
use HasFactory;
use Filterable;
protected function serializeDate(\DateTimeInterface $date)
{
return $date->format('Y-m-d H:i:s');
}
protected $fillable = [
'name', 'code',
'parent_id', 'type_id',
'address',
'person_id',
'sort',
'remarks'
];
public function parent()
{
return $this->belongsTo(static::class, 'parent_id');
}
public function type()
{
return $this->belongsTo(Keyword::class, 'type_id');
}
}