Files
animethemes-server/app/Filament/Tabs/Video/VideoResolutionTab.php
T
2024-05-23 17:22:01 -03:00

59 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Filament\Tabs\Video;
use App\Filament\Tabs\BaseTab;
use App\Models\Wiki\Video;
use Illuminate\Database\Eloquent\Builder;
/**
* Class VideoResolutionTab.
*/
class VideoResolutionTab extends BaseTab
{
/**
* Get the key for the tab.
*
* @return string
*/
public static function getKey(): string
{
return 'video-resolution-tab';
}
/**
* Get the displayable name of the tab.
*
* @return string
*
* @noinspection PhpMissingParentCallCommonInspection
*/
public function getLabel(): string
{
return __('filament.tabs.video.resolution.name');
}
/**
* The query used to refine the models for the tab.
*
* @param Builder $query
* @return Builder
*/
public function modifyQuery(Builder $query): Builder
{
return $query->whereNull(Video::ATTRIBUTE_RESOLUTION);
}
/**
* Get the badge for the tab.
*
* @return int
*/
public function getBadge(): int
{
return Video::query()->whereNull(Video::ATTRIBUTE_RESOLUTION)->count();
}
}