d2d.emegrendeles.hu/app/Services/ProductService.php
E98Developer 68b7c35bef git init
2026-02-28 06:53:05 +01:00

41 lines
978 B
PHP

<?php
namespace App\Services;
use App\Repositories\ProductRepositoryInterface;
class ProductService extends ServiceBase
{
public function __construct(ProductRepositoryInterface $Repository)
{
parent::__construct();
$this->Repository = $Repository;
// $this->setRelation('contact','productGroup');
}
public function updatePrice($id, float $price): bool
{
if (! $this->Repository->updatePrice($id, $price)) {
$this->error->add('Update', 'Nem sikerült az ár módosítása!');
return false;
}
return true;
}
public function update($id, array $data): bool
{
$changed = $this->Repository->checkIsChanged($id, $data);
if ($changed) {
if (! $this->Repository->update($id, $data)) {
$this->error->add('Update', 'Nem sikerült a módosítás!');
return false;
}
}
return true;
}
}