generated from spatie/package-skeleton-laravel
-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathHasParent.php
35 lines (29 loc) · 841 Bytes
/
HasParent.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
namespace Statikbe\FilamentFlexibleContentBlocks\Models\Contracts;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
/**
* @property self $parent
* @property $parent_id
* @property Collection $children
*/
interface HasParent
{
/**
* The recursive parent relationship to model parent - child content.
*/
public function parent(): BelongsTo;
/**
* The children relationship models the subcontent of parent content.
*/
public function children(): HasMany;
/**
* Returns true if this model has a parent.
*/
public function hasParent(): bool;
/**
* Checks if this model is the parent of the given $child.
*/
public function isParentOf(self $child): bool;
}