Skip to content

Instantly share code, notes, and snippets.

@joaorobertopb
Last active March 25, 2018 17:24
Show Gist options
  • Save joaorobertopb/5863e88cb6e474ee19d3fbf98d47b0fe to your computer and use it in GitHub Desktop.
Save joaorobertopb/5863e88cb6e474ee19d3fbf98d47b0fe to your computer and use it in GitHub Desktop.
<?php
namespace App\Scope;
use Illumiante\Database\Query\Builder as QueryBuilder;
use Illuminate\Database\Eloquent\Builder;
use illuminate\Database\Eloquent\ScopeInterface;
class MultiEmpresaScope implements ScopeInterface {
public function apply(Builder $builder) {
$empresaId = ''; //aqui você recupera o Id da Empresa, pode ser pela sessão, por variavel de ambiente e etc...
$builder->where('empresa_id', $empresaId);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment