converted transfer check from category to type

This commit is contained in:
Denis Duliçi
2022-07-21 01:07:55 +03:00
parent 16c645b4a0
commit 5a7697f741
18 changed files with 221 additions and 109 deletions

View File

@ -7,7 +7,7 @@ use Illuminate\Support\Str;
trait Categories
{
public function getCategoryTypes()
public function getCategoryTypes(): array
{
$types = [];
$configs = config('type.category');
@ -27,8 +27,20 @@ trait Categories
return $types;
}
public function getCategoryWithoutChildren($id)
public function getCategoryWithoutChildren(int $id): mixed
{
return Category::getWithoutChildren()->find($id);;
return Category::getWithoutChildren()->find($id);
}
public function getTransferCategoryId(): mixed
{
return Category::other()->pluck('id')->first();
}
public function isTransferCategory(): bool
{
$id = $this->id ?? $this->category->id ?? $this->model->id ?? 0;
return $id == $this->getTransferCategoryId();
}
}