Skip to content

Instantly share code, notes, and snippets.

@amir9480
Created May 20, 2019 18:03
Show Gist options
  • Save amir9480/246ed40d4c5e0110d5aa751d41ff86c3 to your computer and use it in GitHub Desktop.
Save amir9480/246ed40d4c5e0110d5aa751d41ff86c3 to your computer and use it in GitHub Desktop.
vasiat laravel
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;
class BlogComment extends Model
{
protected static function boot()
{
parent::boot();
static::addGlobalScope("confirmed", function (Builder $query) {
$query->where('confirmed', 1);
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment