New

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

mrterryh/laravel-repos

Small Laravel 5 repositories package to abstract the database layer of your web application.
76 2
Install
composer require mrterryh/laravel-repos
Latest Version:1.2.1
PHP:>=5.4.0
License:MIT
Last Updated:Sep 22, 2015
Links: GitHub  ·  Packagist
Maintainer: mrterryh

Laravel Repos

Small Laravel 5 repositories package to abstract the database layer of your web application.

Installation

Install the package by running, either by running the following command in your project root:

$ composer require mrterryh/laravel-repos

Or by adding the following line to the require object in your composer.json file:

"mrterryh/laravel-repos": "1.*"

Then run $ composer update in your command line to install the dependency.

Usage

Anywhere within your application, create a new file. The file name convention for this package is [Model]Repository.php. Let's use the standard Laravel User model for this example.

Create a new file UserRepository.php in app/Repositories, and create a class within the file that extends Mrterryh\Repositories\Base\EloquentRepository:

use Mrterryh\Repositories\Base\EloquentRepository;

class UserRepository extends EloquentRepository
{
    
}

Then, provide the full, namespaced path of the model in the $model property.

use Mrterryh\Repositories\Base\EloquentRepository;

class UserRepository extends EloquentRepository
{
    protected $model = 'App\User';
}

Related Packages

littlebug/laravel-repository

The repository mode for laravel!

4,242 35
buqiu/repository

Laravel Repository 是 Laravel 的一个软件包,用于抽象数据库层。 这使应用程序易于...

2,889 3
znck/repository

A better way to work around Eloquent.

1,306 2

Version History

Version Released PHP License
1.2.1 >=5.4.0 MIT
1.2.0 >=5.4.0 MIT
1.1.1 >=5.4.0 MIT
1.1.0 >=5.4.0 MIT
1.0.0 >=5.4.0 MIT