Edit File: CountryService.php
<?php namespace App\Services\Entity; use App\Models\Country; class CountryService extends BaseService { /** * Initializes the CountryService class. * * @param Country $country The country model instance. */ public function __construct(Country $country) { $this->model = $country; } /** * Get all countries. * * @return array An array of all countries. */ public function index() { if (request()->ajax()) { $countries = Country::search(request('searchArray')) ->latest('id') ->paginate(30); $html = view('admin.countries.table', compact('countries'))->render(); return response()->json(['html' => $html]); } return view('admin.countries.index'); } }
Back to File Manager