firstcommit
This commit is contained in:
0
Modules/Estimate/app/Repositories/.gitkeep
Normal file
0
Modules/Estimate/app/Repositories/.gitkeep
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Estimate\Repositories;
|
||||
|
||||
interface EstimateDetailInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getEstimateDetailById($EstimateDetailId);
|
||||
public function delete($EstimateDetailId);
|
||||
public function create($EstimateDetailDetails);
|
||||
public function update($EstimateDetailId, array $newDetails);
|
||||
public function pluck();
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Estimate\Repositories;
|
||||
|
||||
use Modules\Estimate\Models\EstimateDetail;
|
||||
|
||||
class EstimateDetailRepository implements EstimateDetailInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return EstimateDetail::all();
|
||||
}
|
||||
|
||||
public function getEstimateDetailById($EstimateDetailId)
|
||||
{
|
||||
return EstimateDetail::findOrFail($EstimateDetailId);
|
||||
}
|
||||
|
||||
|
||||
public function delete($EstimateDetailId)
|
||||
{
|
||||
EstimateDetail::destroy($EstimateDetailId);
|
||||
}
|
||||
|
||||
public function create($EstimateDetailDetails)
|
||||
{
|
||||
return EstimateDetail::create($EstimateDetailDetails);
|
||||
}
|
||||
|
||||
public function update($EstimateDetailId, array $newDetails)
|
||||
{
|
||||
return EstimateDetail::whereId($EstimateDetailId)->update($newDetails);
|
||||
}
|
||||
|
||||
public function pluck()
|
||||
{
|
||||
return EstimateDetail::pluck('title', 'id');
|
||||
}
|
||||
|
||||
}
|
14
Modules/Estimate/app/Repositories/EstimateInterface.php
Normal file
14
Modules/Estimate/app/Repositories/EstimateInterface.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Estimate\Repositories;
|
||||
|
||||
interface EstimateInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getEstimateById($EstimateId);
|
||||
public function delete($EstimateId);
|
||||
public function create($EstimateDetails);
|
||||
public function update($EstimateId, array $newDetails);
|
||||
public function pluck();
|
||||
|
||||
}
|
40
Modules/Estimate/app/Repositories/EstimateRepository.php
Normal file
40
Modules/Estimate/app/Repositories/EstimateRepository.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?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');
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user