0
--------------------------
|id name parent_id
--------------------------
|1 Memory NULL
|2 RAM 1
我的功能和子功能我的模型如下
class Feature extends Model
{
public $fillable = ['name','parent_id'];
public function parent()
{
return $this->belongsTo('App\Feature','parent_id');
}
public function child()
{
return $this->hasMany('App\Feature','parent_id');
}
}
現在我想取父功能和子功能,