New

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

aubinlrx/laravelrepositories

Laravel Repositories
17 12

Larablocks Analysis

aubinlrx/laravelrepositories works with Laravel 5 (latest release 0.1.5, May 12, 2015), which reached end of life: no more fixes, even for security.

Recommendation checks

Not advised

Not advised: no release or commit in over 2 years.

  • No release or commit in over 2 years
  • Supports only Laravel 5, past end of life
  • No release in the last 12 months (last: May 12, 2015)
  • 0 downloads a month (needs 10,000)
  • 12 GitHub stars (needs 100)

State

Likely abandoned
  • No release or commit in over 2 years.
  • Last stable release: May 12, 2015.
  • No releases in the last 12 months.
  • First released: Apr 24, 2015.
  • 0 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Dec 1, 2026.

Install
composer require aubinlrx/laravelrepositories
Latest Version:0.1.5
PHP:>=5.4.0
Laravel:5
License:MIT
Last Updated:Jul 24, 2015
Links: GitHub  ·  Packagist
Maintainer: AubinLrx

LaravelRepositories

Repository Pattern for Laravel 5 with Eloquent ORM

Version: 0.1.5

Filterable Trait

Handy method to filter query

Usages

<?php

use AubinLrx\LaravelRepositories\Repository;
use AubinLrx\LaravelRepositories\Traits\FilterableTrait;

class BookRepository extends Repository {

   use FilterableTrait;
   
   /**
    * The fields that are filterable
    * @var array
    */
   protected $filterable = ['author_id', 'date_range'];

   public function getAllWithFilter() {
      return $this->applyFilterToQuery( $this->model->query() )->all(); 
   }

   public function filterByDateRange($query, $value) {
        return $query->whereBetween('date', $value);
   }

   public function filterBy($field, $value) {
        $this->addFilter($field, $value);
        return $this;
   }

}

class BookController extends Controller {

    public function __construct(BookRepository $books) 
    {
        $this->books = $books;
    }

    public function index(Request $request) 
    {
        $books = $this->books->filterBy('date_range', $request->only(['str_date', 'end_date']))
           ->filterBy('author_id', $request->only('author_id'))
           ->getAllWithFilter();

        return view('books.index', compact('books'));
    }

}

?>

Release Logs

v0.1.5

  • bug fix: Laravel 5.1 create method
  • feature: Add findOrFail method

Alternatives to aubinlrx/laravelrepositories

torann/laravel-repository

Base repository implementation for Laravel

520,153 88
czim/laravel-repository

Repository for Laravel (inspired by and indebted to Bosnadev/Repositories)

118,367 52

Version History

Version Released PHP Laravel License
0.1.5 >=5.4.0 5.* MIT
0.1.4 >=5.4.0 5.* MIT
0.1.3 >=5.4.0 5.* MIT
0.1.2 >=5.4.0 5.* MIT
0.1.1 >=5.4.0 5.* MIT