Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

model laravel

<?php

namespace AppModels;

use IlluminateDatabaseEloquentBuilder;
use IlluminateDatabaseEloquentModel;

class User extends Model
{
    /**
     * The "booted" method of the model.
     *
     * @return void
     */
    protected static function booted()
    {
        static::addGlobalScope('age', function (Builder $builder) {
            $builder->where('age', '>', 200);
        });
    }
}
Source by laravel.com #
 
PREVIOUS NEXT
Tagged: #model #laravel
ADD COMMENT
Topic
Name
7+7 =