Global Scopes: Applying Global Scopes

<?php

namespace App;

use App\Scopes\AgeScope;
use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    /**
     * The "booting" method of the model.
     *
     * @return void
     */
    protected static function boot()
    {
        parent::boot();

        static::addGlobalScope(new AgeScope);
    }
}

Global Scopes: Applying Global Scopes — Structure map

Clickable & Draggable!

Global Scopes: Applying Global Scopes — Related pages: