40 lines
743 B
PHP
40 lines
743 B
PHP
<?php
|
|
|
|
namespace Modules\Admin\Repositories;
|
|
|
|
use Modules\Admin\Models\Country;
|
|
|
|
|
|
class CountryRepository implements CountryInterface
|
|
{
|
|
public function findAll()
|
|
{
|
|
return Country::get();
|
|
}
|
|
|
|
public function getCountryById($countryId)
|
|
{
|
|
return Country::findOrFail($countryId);
|
|
}
|
|
|
|
public function delete($countryId)
|
|
{
|
|
Country::destroy($countryId);
|
|
}
|
|
|
|
public function create(array $countryDetails)
|
|
{
|
|
return Country::create($countryDetails);
|
|
}
|
|
|
|
public function update($countryId, array $newDetails)
|
|
{
|
|
return Country::where('id', $countryId)->update($newDetails);
|
|
}
|
|
|
|
public function pluck(){
|
|
return Country::pluck('name','id');
|
|
}
|
|
|
|
}
|