Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

benjamincrozat/blog-v5

126 stars
1 code files
View benjamincrozat/blog-v5 on GitHub

app/Models/Metric.php

Open in GitHub
use Illuminate\Database\Eloquent\Model;
use Illuminate\Contracts\Database\Eloquent\Builder;
 
class Metric extends Model
{
protected static function booted() : void
{
static::addGlobalScope('latest', function (Builder $builder) {
$builder->latest();
});
}
}

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.