Created
May 20, 2019 18:03
-
-
Save amir9480/246ed40d4c5e0110d5aa751d41ff86c3 to your computer and use it in GitHub Desktop.
vasiat laravel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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