| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- declare(strict_types=1);
- namespace App\Model;
- use Hyperf\DbConnection\Model\Model;
- /**
- */
- class Article extends Model
- {
- /**
- * The table associated with the model.
- */
- protected ?string $table = 'article';
- /**
- * 定义与分类的多对一关系
- */
- public function category()
- {
- return $this->belongsTo(Category::class, 'category_id', 'id');
- }
- /**
- * 定义与分类的多对一关系
- */
- public function websiteCategory()
- {
- return $this->belongsTo(WebsiteCategory::class, 'category_id', 'id');
- }
- /**
- * The attributes that are mass assignable.
- */
- protected array $fillable = [];
- /**
- * The attributes that should be cast to native types.
- */
- protected array $casts = [];
- }
|