Heera/Modules/Estimate/app/Repositories/EstimateRepository.php
2024-05-16 09:31:08 +05:45

41 lines
789 B
PHP

<?php
namespace Modules\Estimate\Repositories;
use Modules\Estimate\Models\Estimate;
class EstimateRepository implements EstimateInterface
{
public function findAll()
{
return Estimate::all();
}
public function getEstimateById($EstimateId)
{
return Estimate::with('estimateDetails')->findOrFail($EstimateId);
}
public function delete($EstimateId)
{
Estimate::destroy($EstimateId);
}
public function create($EstimateDetails)
{
return Estimate::create($EstimateDetails);
}
public function update($EstimateId, array $newDetails)
{
return Estimate::whereId($EstimateId)->update($newDetails);
}
public function pluck()
{
return Estimate::pluck('title', 'id');
}
}