chiragardeshna/dbextender

It extends laravel default Query builder and Eloquent.

1.0.0 2017-08-10 07:33 UTC

This package is not auto-updated.

Last update: 2024-04-14 01:30:23 UTC


README

It extends laravel \ lumen default Query builder.

How to install

composer require chiragardeshna/dbextender

Laravel Setup

Run php artisan vendor:publish.
Put Chiragardeshna\Dbextender\DBExtenderServiceProvider::class in config/app.php in providers array.

Lumen Setup

Create dbextender.php file and put it in config/dbextender.php.

dbextender.php

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Query Builder
    |--------------------------------------------------------------------------
    |
    | Here you can specify a class which extends default Illuminate\Database\Query\Builder.
    | It's important that specified class extend behaviour from default Query Builder class.
    |
    */
    'builder' =>  'App\Query\Builder',

];

Register this new config file in bootstrap/app.php.

$app->register(Chiragardeshna\Dbextender\DBExtenderServiceProvider::class);
$app->configure('dbextender');

Create app/query/Builder.php file

<?php

namespace App\Query;

use Illuminate\Database\Query\Builder as QueryBuilder;

class Builder extends QueryBuilder
{
    // put your methods here.
}

And that's it enjoy.