Skip to content

Instantly share code, notes, and snippets.

@morrislaptop
Created January 13, 2021 21:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save morrislaptop/5f5ba14ee53b9fb91a13bc109a60e0ed to your computer and use it in GitHub Desktop.
Save morrislaptop/5f5ba14ee53b9fb91a13bc109a60e0ed to your computer and use it in GitHub Desktop.
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Storage;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Laravel\Scout\Searchable;
trait BuildBehaviour
{
use Searchable;
public function shortSha()
{
return substr($this->sha, 0, 7);
}
public function scopePublished($query)
{
return $query
->where('status', 'published')
->latest('build_finished_at');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment