| Package Data | |
|---|---|
| Maintainer Username: | KyleNoland |
| Maintainer Contact: | kylenoland@gmail.com (Kyle Noland) |
| Package Create Date: | 2014-12-21 |
| Package Last Update: | 2015-02-20 |
| Language: | PHP |
| License: | Unknown |
| Last Refreshed: | 2025-12-09 15:00:20 |
| Package Statistics | |
|---|---|
| Total Downloads: | 60 |
| Monthly Downloads: | 0 |
| Daily Downloads: | 0 |
| Total Stars: | 14 |
| Total Watchers: | 3 |
| Total Forks: | 9 |
| Total Open Issues: | 0 |
A flexible Laravel repository pattern foundation for working with Eloquent ORM.
The goal of this package is to provide a foundation for building Laravel Eloquent repositories while still allowing you to create basic queries on the fly.
Install this package through Compposer. Edit your project's composer.json file to require kyle-noland/laravel-base-repository
"require": {
"kyle-noland/laravel-base-repository": "dev-master"
}
Update Composer from the Terminal
composer update
Add the Service Provider to your app/config/app.php file
'KyleNoland\LaravelBaseRepository\LaravelBaseRepositoryServiceProvider'
Extend the BaseRepository class and implement your own custom repository logic:
<?php namespace MyProject\Repositories;
use KyleNoland\LaravelBaseRepository\BaseRepository;
use MyProject\Interfaces\CompanyRepositoryInterface;
use MyProject\Models\Company;
class CompanyRepository extends BaseRepository implements CompanyRepositoryInterface {
public function __construct(Company $model)
{
$this->model = $model;
}
// Add your repository methods here
}
The BaseRepository class provides basic COUNT, SELECT, INSERT, UPDATE, DELETE, WHERE, WHERE IN clauses and the ability to eager load related models.
$count = $this->companyRepo->count();
$count = $this->companyRepo->where('is_active', true)->count();
$allCompanies = $this->companyRepo->all();
$activeCompanies = $this->companyRepo->where('is_active', true)->get();
$activeCopmaniesInTexas = $this->companyRepo->where('is_active', true)->where('state', 'TX')->get();