1234567891011121314151617181920212223242526272829303132 |
- <?php
- namespace App\Repositories;
- use App\Models\ConfigCityManagement;
- class ConfigCityManagementRepository
- {
- public function __construct(ConfigCityManagement $configCityManagement)
- {
- $this->configCityManagement = $configCityManagement;
- }
- public function index($request)
- {
- $perPage = isset($request['per_page']) ? $request['per_page'] : env('PER_PAGE');
- if (isset($request['city_id'])) {
- $this->configCityManagement = $this->configCityManagement
- ->orderBy('id', 'desc')
- ->where(['status' => 1,'city_id' => $request['city_id']]);
- }else{
- $this->configCityManagement = $this->configCityManagement
- ->orderBy('id', 'desc')
- ->where('status',1);
- }
- return $this->configCityManagement->paginate($perPage);
- }
- }
|