1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- namespace App\Models;
- // use Illuminate\Contracts\Authenticate\MustVerifyEmail;
- use DateTimeInterface;
- use Illuminate\Database\Eloquent\Factories\HasFactory;
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Foundation\Auth\User as Authenticatable;
- use Illuminate\Notifications\Notifiable;
- use Laravel\Sanctum\HasApiTokens;
- use Tymon\JWTAuth\Contracts\JWTSubject;
- class Region extends Model
- {
- use HasFactory;
- // 设置表名
- protected $table = 'region';
- // 设置主键
- // public $primaryKey = 'id';
- /**
- * 自动生成时间戳
- */
- public $timestamps = FALSE;
- /**
- * 日期时间的存储格式
- *
- * @var string
- */
- // protected $dateFormat = 'Y-m-d H:i:s';
- /**
- * The attributes that are mass assignable.
- *
- * @var array<int, string>
- */
- protected $fillable = [];
- /**
- * The attributes that should be hidden for serialization.
- *
- * @var array<int, string>
- */
- protected $hidden = [];
- public function children()
- {
- return $this->hasMany(Region::class,'parentId','id');
- }
- public function service()
- {
- return $this->hasOne(ProjectServiceRelevancy::class,'service_id','id');
- }
- }
|