36 lines
612 B
PHP
36 lines
612 B
PHP
|
<?php
|
||
|
|
||
|
namespace Modules\Admin\Repositories;
|
||
|
|
||
|
use Modules\Admin\Models\City;
|
||
|
|
||
|
|
||
|
class CityRepository implements CityInterface
|
||
|
{
|
||
|
public function findAll()
|
||
|
{
|
||
|
return City::get();
|
||
|
}
|
||
|
|
||
|
public function getCityById($cityId)
|
||
|
{
|
||
|
return City::findOrFail($cityId);
|
||
|
}
|
||
|
|
||
|
public function delete($cityId)
|
||
|
{
|
||
|
City::destroy($cityId);
|
||
|
}
|
||
|
|
||
|
public function create(array $cityDetails)
|
||
|
{
|
||
|
return City::create($cityDetails);
|
||
|
}
|
||
|
|
||
|
public function update($cityId, array $newDetails)
|
||
|
{
|
||
|
return City::where('id', $cityId)->update($newDetails);
|
||
|
}
|
||
|
|
||
|
}
|