Skip to main content

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

Read more here

alkrauss48/simple-slides

98 stars
2 code files
View alkrauss48/simple-slides on GitHub

app/Enums/PresentationFilter.php

Open in GitHub
enum PresentationFilter: string
{
use Traits\EnumToArray;
 
case INSTRUCTIONS = 'instructions';
case ADHOC = 'adhoc';
 
public function label(): string
{
return match ($this) {
self::INSTRUCTIONS => 'Instructions',
self::ADHOC => 'Adhoc',
};
}
}

app/Models/DailyView.php

Open in GitHub
use App\Enums\PresentationFilter;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
 
class DailyView extends Model
{
// ...
 
public function scopeStats(Builder $query, ?string $presentationId = null): void
{
if ($presentationId === PresentationFilter::INSTRUCTIONS->value) {
$query
->whereNull('presentation_id')
->whereNull('adhoc_slug');
 
return;
}
 
if ($presentationId === PresentationFilter::ADHOC->value) {
$query
->whereNull('presentation_id')
->whereNotNull('adhoc_slug')
->get();
 
return;
}
 
if (is_null($presentationId)) {
return;
}
 
$query->where('presentation_id', intval($presentationId));
}
 
// ...
}

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.