New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

shekarsiri/baserepo

Base repositories
90
Install
composer require shekarsiri/baserepo
Latest Version:1.2
PHP:>=5.5.9
Laravel:5
License:MIT
Last Updated:Nov 27, 2015
Links: GitHub  ·  Packagist
Maintainer: shekarsiri

Base Repository

Example

Repository


use ShekarSiri\BaseRepo\Crudable;
use ShekarSiri\BaseRepo\Pagination;
use ShekarSiri\BaseRepo\Repo;


/**
 * Interface LocationRepository
 *
 */
interface LocationRepository extends Crudable, Repo, Pagination
{

}

Implementation


use Location;
use ShekarSiri\BaseRepo\CrudableTrait;
use ShekarSiri\BaseRepo\PaginationTrait;
use ShekarSiri\BaseRepo\RepoTrait;

/**
 * Class LocationRepositoryEloquent
 * 
 */
class LocationRepositoryEloquent implements LocationRepository
{
    use CrudableTrait, PaginationTrait, RepoTrait;

    private $queries = [
        'name' => 'LIKE'
    ];

    function __construct(Location $model)
    {
        $this->model = $model;
    }

}

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);
    }

   
}

Related Packages

dannyweeks/laravel-base-repository

An abstract repository class for your Eloquent repositories that requires minima...

2,028 20
fivesqrd/fluent-laravel

A Laravel 5 service provider for including the Fluent PHP library.

3,198 0
datastat/megapos

EON MegaPOS for laravel 5

32 0

Version History

Version Released PHP Laravel License
1.2 >=5.5.9 ^5.1 MIT
1.1 >=5.5.9 ^5.1 MIT
1.0 >=5.5.9 ^5.1 MIT