| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?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';
- /**
- * The attributes that are mass assignable.
- */
- protected array $fillable = [];
- /**
- * The attributes that should be cast to native types.
- */
- protected array $casts = [];
- /**
- * 定义与分类的多对一关系
- */
- public function category()
- {
- return $this->belongsTo(Category::class, 'catid', 'id');
- }
- /**
- * 定义与分类的多对一关系
- */
- public function websiteCategory()
- {
- return $this->belongsTo(WebsiteCategory::class, 'catid', 'category_id');
- }
- /**
- * 定义与分类的多对一关系
- */
- public function aricleIgnore()
- {
- return $this->belongsTo(ArticleIgnore::class, 'id', 'article_id');
- }
- /**
- * 定义与分类的一对一关系
- */
- public function user()
- {
- return $this->hasOne(User::class, 'id', 'admin_user_id');
- }
- }
|