2016-03-25 01:18:05 -07:00
|
|
|
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
|
2019-03-13 20:12:03 -07:00
|
|
|
use Illuminate\Database\Eloquent\Builder;
|
2016-03-25 01:18:05 -07:00
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2019-03-13 20:12:03 -07:00
|
|
|
use Illuminate\Database\Eloquent\Scope;
|
2016-03-25 01:18:05 -07:00
|
|
|
|
2016-04-07 13:21:09 -07:00
|
|
|
/**
|
|
|
|
* Handle query scoping for full company support.
|
|
|
|
*
|
|
|
|
* @todo Move this to a more Laravel 5.2 esque way
|
|
|
|
* @version v1.0
|
|
|
|
*/
|
2016-03-25 01:18:05 -07:00
|
|
|
final class CompanyableScope implements Scope
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Apply the scope to a given Eloquent query builder.
|
|
|
|
*
|
|
|
|
* @param \Illuminate\Database\Eloquent\Builder $builder
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function apply(Builder $builder, Model $model)
|
|
|
|
{
|
|
|
|
return Company::scopeCompanyables($builder);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @todo IMPLEMENT
|
|
|
|
* Remove the scope from the given Eloquent query builder.
|
|
|
|
*
|
|
|
|
* @param \Illuminate\Database\Eloquent\Builder $builder
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function remove(Builder $builder)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|