PHP code example of shekarsiri / baserepo

1. Go to this page and download the library: Download shekarsiri/baserepo library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

shekarsiri / baserepo example snippets


use LocationRepository;
use Illuminate\Http\Request;

class LocationController extends Controller
{

    /**
     * @var LocationRepository
     */
    private $repo;

    function __construct(LocationRepository $repo)
    {
        $this->middleware('auth', ['except' => ['autoComplete']]);
        $this->repo = $repo;
    }

    public function index(Request $request)
    {
        $locations = $this->repo->pagination(10, [], $request->all());
        return response()->json($locations, 200);
    }

   
}