📜  laravel 递归关系 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:05.295000             🧑  作者: Mango

代码示例1
class Item extends Model {
  protected $with = ['children'];

  public function children() {
    $this->hasMany(App\Items::class, 'parent_id', 'id');
 }
}