File: D:/HostingSpaces/SBogers10/farmfun.komma.pro/app/Komma/ProductCategories/ProductCategoryService.php
<?php
namespace App\Komma\ProductCategories;
use App\Komma\Base\Service;
use App\Komma\ProductCategories\Models\ProductCategory;
class ProductCategoryService extends Service
{
private $productCategories;
public function __construct()
{
parent::__construct();
// Set options first if needed
if (! isset($this->options)) {
$this->setProductCategories();
}
}
/**
* @return mixed
*/
public function getProductCategories()
{
return $this->productCategories;
}
public function setProductCategories(): void
{
$this->productCategories = ProductCategory::where('active', 1)
->with('translation')
->has('translation')
->orderBy('lft')
->get();
}
}