-
app/Models/Stream.php
Open in GitHubuse 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, ]); } }
-
app/Http/Controllers/PageHomeController.php
Open in GitHubuse 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()), ]); } }