Example of Local scopes in christophrumpel/larastreamers

File app/Models/Stream.php (link to Github)
use Illuminate\Database\Eloquent\Model;

class Stream extends Model
{
    //
    public function scopeApproved(Builder $query): void
    {
        $query->whereNotNull('approved_at');
    }

    public function scopeUpcoming(Builder $query): Builder
    {
        return $query->whereIn('status', [
            StreamData::STATUS_LIVE,
            StreamData::STATUS_UPCOMING,
        ]);
    }
}
File app/Http/Controllers/PageHomeController.php (link to Github)
use App\Actions\PrepareStreams;
use App\Models\Stream;
use Illuminate\Contracts\View\View;

class PageHomeController extends Controller
{
    public function __invoke(PrepareStreams $prepareStreams): View
    {
        return view('pages.home', [
            'streamsByDate' => $prepareStreams->handle(Stream::approved()->upcoming()->get()),
        ]);
    }
}

Additional resources on local scopes: