Skip to content
This repository has been archived by the owner on Apr 9, 2021. It is now read-only.
/ builders Public archive
generated from sfneal/php-package-boilerplate

Eloquent\Builder wrapper with extended functionality

License

Notifications You must be signed in to change notification settings

sfneal/builders

Repository files navigation

Query Builders

Packagist PHP support Latest Version on Packagist Build Status StyleCI Scrutinizer Code Quality Total Downloads

Eloquent\Builder wrapper with extended functionality.

Installation

You can install the package via composer:

composer require sfneal/builders

Usage

Add the custom QueryBuilder to any Eloquent model by overwriting the built-in newEloquentBuilder() & query() methods.

use Illuminate\Database\Eloquent\Builder;
use Sfneal\Builders\QueryBuilder;

class ExampleModel extends Model
{
    /**
     * Query Builder.
     *
     * @param $query
     * @return QueryBuilder
     */
    public function newEloquentBuilder($query)
    {
        return new QueryBuilder($query);
    }
    
    /**
     * Query Builder method for improved type hinting.
     *
     * @return QueryBuilder|Builder
     */
    public static function query()
    {
        return parent::query();
    }
}

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email stephen.neal14@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

PHP Package Boilerplate

This package was generated using the PHP Package Boilerplate.

About

Eloquent\Builder wrapper with extended functionality

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages