laraerp/ordination

2,487 8
Install
composer require laraerp/ordination
Latest Version:v1.0.4
PHP:>=5.4.0
Laravel:5
License:MIT
Last Updated:Sep 25, 2019
Links: GitHub  ·  Packagist
Maintainer: jansenfelipe

Ordination

Latest Stable Version Total Downloads Latest Unstable Version License

Adiciona ao model Eloquent o recurso de ordenar consulta por models relacionados.

Exemplo:

$clientes = Cliente::orderBy('pessoa.nome', 'desc')->get();

Como utilizar

Adicione a library

$ composer require laraerp/ordination

Adicione o ServiceProvider no arquivo config/app.php

// file START ommited
    'providers' => [
        // other providers ommited
        \Laraerp\Ordination\OrdinationServiceProvider::class,
    ],
    
    'aliases' => [
        // other aliases ommited
        'Order' => Laraerp\Ordination\Facade::class,
    ],
    
// file END ommited

Adicione a trait OrdinationTrait no model:

use Laraerp\Ordination\OrdinarionTrait;

class Cliente extends Model{

  use OrdinationTrait;
  
  /*
   * Belong To Pessoa
   */
  public function pessoa(){
      return $this->belongsTo(Pessoa::class);
  }

}

Order::url()

Utilize o helper na sua view para gerar um link de ordenação:

<thead>
  <tr>
      <th><a href="{{Order::url('pessoa.documento')}}">Documento</a></th>
      <th><a href="{{Order::url('pessoa.nome')}}">Cliente</a></th>
  </tr>
</thead>

License

The MIT License (MIT)

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

644,549,754 9,698
laravel/framework

The Laravel Framework.

598,760,099 34,966
laravel/tinker

Powerful REPL for the Laravel framework.

507,193,856 7,441
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

423,477,751 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

403,217,078 4,664

Version History

Version Released PHP Laravel License
v1.0.4 >=5.4.0 5.* MIT
v1.0.3 >=5.4.0 5.0.* MIT
v1.0.2 >=5.4.0 5.0.* MIT
v1.0.1 >=5.4.0 5.0.* MIT
1.0.0 >=5.4.0 5.0.* MIT