Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgergo committed Apr 10, 2024
1 parent e1e14af commit e97f1f2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Models/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\SoftDeletes;

Expand Down Expand Up @@ -61,6 +62,14 @@ public function getMorphClass(): string
return static::getProxiedClass();
}

/**
* Get the parent for the category.
*/
public function parent(): BelongsTo
{
return $this->belongsTo(static::class, 'parent_id');
}

/**
* Get the products for the category.
*/
Expand Down

0 comments on commit e97f1f2

Please sign in to comment.