Files
Toiminnanohjaus/app/Modules/Inventory/Infrastructure/Adapters/TaskUsageWithStock.php
T

22 lines
620 B
PHP

<?php
namespace App\Modules\Inventory\Infrastructure\Adapters;
use App\Modules\Inventory\Infrastructure\Persistence\Eloquent\StockMovementModel;
use App\Modules\Jobs\Application\Contracts\TaskUsage;
/**
* A task with recorded material is kept like one with hours: the stock
* movements refer to it.
*/
class TaskUsageWithStock implements TaskUsage
{
public function __construct(private TaskUsage $inner) {}
public function hasTimeEntries(int $taskId): bool
{
return $this->inner->hasTimeEntries($taskId)
|| StockMovementModel::query()->where('task_id', $taskId)->exists();
}
}