Skip to content

Instantly share code, notes, and snippets.

View joaorobertopb's full-sized avatar
💻
Coding

João Roberto P. Borges joaorobertopb

💻
Coding
View GitHub Profile
<?php
namespace App\Scope;
trait IsMultiEmpresaTrait {
protected static function bootIsMultiEmpresa() {
static::addGlobalScope( new MultiEmpresaScope );
}
<?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 {
@joaorobertopb
joaorobertopb / .php_cs.dist
Last active December 17, 2022 15:37
Esse é um exemplo de configuração do php-cs-fixer que foi construído usando a predefinição Laravel do StyleCI.
<?php
$header = <<<'EOF'
Esse arquivo faz parte de <Empresa/Projeto>
(c) Nome Autor <e-mail>
Lorem ipsum ...
EOF;
@joaorobertopb
joaorobertopb / Handler.php
Created February 14, 2017 00:41
Registrando o package Filp/Whoops no Laravel
<?php
namespace App\Exceptions;
use Exception;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
class Handler extends ExceptionHandler
{
@joaorobertopb
joaorobertopb / public-function-render.php
Last active February 14, 2017 01:01
Vamos repassar as exceptions para o Whoops somente quando o ambiente for local e se o debug estiver ativo.
<?php
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $exception)
<?php
/**
* Render an exception using Whoops.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $e
* @return \Illuminate\Http\Response
*/
protected function renderExceptionWithWhoops($request, Exception $e)