36 lines
680 B
PHP
36 lines
680 B
PHP
<?php
|
|
|
|
namespace Modules\Admin\Repositories;
|
|
|
|
use Modules\Admin\Models\District;
|
|
|
|
|
|
class DistrictRepository implements DistrictInterface
|
|
{
|
|
public function findAll()
|
|
{
|
|
return District::get();
|
|
}
|
|
|
|
public function getDistrictById($districtId)
|
|
{
|
|
return District::findOrFail($districtId);
|
|
}
|
|
|
|
public function delete($districtId)
|
|
{
|
|
District::destroy($districtId);
|
|
}
|
|
|
|
public function create(array $districtDetails)
|
|
{
|
|
return District::create($districtDetails);
|
|
}
|
|
|
|
public function update($districtId, array $newDetails)
|
|
{
|
|
return District::where('id', $districtId)->update($newDetails);
|
|
}
|
|
|
|
}
|