| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?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 articleIgnore()
- {
- return $this->hasOne(ArticleIgnore::class, 'article_id', 'id')
- // ->whereColumn('article_ignore.website_id', 'article.web_site_id')
- ;
- }
- }
|