Skip to content

Commit d8831fe

Browse files
add parent relationship
1 parent ca96acb commit d8831fe

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Models/Menu.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,14 @@ public function scopeVisible($query)
7979
{
8080
return $query->where('visible', true);
8181
}
82+
83+
/**
84+
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
85+
*/
86+
public function parent()
87+
{
88+
return $this->belongsTo(Menu::class, 'parent_id');
89+
}
8290

8391
/**
8492
* @return \Illuminate\Database\Eloquent\Relations\HasMany

0 commit comments

Comments
 (0)