39 lines
762 B
PHP
39 lines
762 B
PHP
|
<?php
|
||
|
|
||
|
namespace Modules\Office\Repositories;
|
||
|
|
||
|
use Modules\Office\Models\Contract;
|
||
|
|
||
|
|
||
|
class ContractRepository implements ContractInterface
|
||
|
{
|
||
|
public function pluck(){
|
||
|
return Contract::pluck('name','id');
|
||
|
}
|
||
|
public function findAll()
|
||
|
{
|
||
|
return Contract::get();
|
||
|
}
|
||
|
|
||
|
public function getContractById($contractId)
|
||
|
{
|
||
|
return Contract::findOrFail($contractId);
|
||
|
}
|
||
|
|
||
|
public function delete($contractId)
|
||
|
{
|
||
|
Contract::destroy($contractId);
|
||
|
}
|
||
|
|
||
|
public function create(array $contractDetails)
|
||
|
{
|
||
|
return Contract::create($contractDetails);
|
||
|
}
|
||
|
|
||
|
public function update($contractId, array $newDetails)
|
||
|
{
|
||
|
return Contract::where('id', $contractId)->update($newDetails);
|
||
|
}
|
||
|
|
||
|
}
|