测试
This commit is contained in:
@@ -40,14 +40,17 @@ class Category extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* 关联的数据
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany|\Illuminate\Database\Eloquent\Relations\HasMany|\Illuminate\Database\Eloquent\Relations\HasOne|null [type] [description]
|
||||
* Notes: description
|
||||
* @Author: 玄尘
|
||||
* @Date : 2021/10/14 11:53
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo|\Illuminate\Database\Eloquent\Relations\HasMany|null
|
||||
*/
|
||||
public function relations()
|
||||
{
|
||||
switch ($this->type) {
|
||||
case self::TYPE_SHOW:
|
||||
return $this->hasOne(Article::class)->where('id', $this->article_id);
|
||||
return $this->belongsTo(Article::class);
|
||||
// return $this->hasOne(Article::class);
|
||||
break;
|
||||
case self::TYPE_ARTICLE:
|
||||
// return $this->belongsToMany(Article::class);
|
||||
|
||||
Reference in New Issue
Block a user