ConfigCityManagementRepository.php 872 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace App\Repositories;
  3. use App\Models\ConfigCityManagement;
  4. class ConfigCityManagementRepository
  5. {
  6. public function __construct(ConfigCityManagement $configCityManagement)
  7. {
  8. $this->configCityManagement = $configCityManagement;
  9. }
  10. public function index($request)
  11. {
  12. $perPage = isset($request['per_page']) ? $request['per_page'] : env('PER_PAGE');
  13. if (isset($request['city_id'])) {
  14. $this->configCityManagement = $this->configCityManagement
  15. ->orderBy('id', 'desc')
  16. ->where(['status' => 1,'city_id' => $request['city_id']]);
  17. }else{
  18. $this->configCityManagement = $this->configCityManagement
  19. ->orderBy('id', 'desc')
  20. ->where('status',1);
  21. }
  22. return $this->configCityManagement->paginate($perPage);
  23. }
  24. }