feat: introducing flexible cache to improve performance (#754)

This commit is contained in:
Kyrch
2024-10-22 12:10:44 -03:00
committed by GitHub
parent 0e6a401154
commit 3ce9bb09b7
55 changed files with 889 additions and 373 deletions
+2
View File
@@ -6,6 +6,8 @@ API_URL=
APP_NAME=AnimeThemes
APP_ENV=local
APP_DEBUG=true
DEBUGBAR_ENABLED=true
DEBUGBAR_EDITOR=
APP_URL=http://localhost
ASSET_URL=null
APP_KEY=
+2
View File
@@ -6,6 +6,8 @@ API_URL=
APP_NAME=AnimeThemes
APP_ENV=local
APP_DEBUG=true
DEBUGBAR_ENABLED=true
DEBUGBAR_EDITOR=
APP_URL=http://localhost
ASSET_URL=null
APP_KEY=
@@ -65,7 +65,7 @@ class DiscordVideoNotificationAction
Arr::set($videoArray, Video::ATTRIBUTE_OVERLAP, $video->overlap->localize());
Arr::set($videoArray, 'animethemeentries.0.animetheme.type', $theme->type->localize());
foreach ($videoArray['animethemeentries.0.animetheme.anime.images'] as $key => $image) {
foreach (Arr::get($videoArray, 'animethemeentries.0.animetheme.anime.images') as $key => $image) {
Arr::set($videoArray, "animethemeentries.0.animetheme.anime.images.$key.facet", $anime->images->get($key)->facet->localize());
}
@@ -9,6 +9,7 @@ use App\Models\Wiki\Anime;
use App\Models\Wiki\ExternalResource;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Cache;
/**
* Class BaseStoreExternalProfileAction.
@@ -22,18 +23,18 @@ abstract class BaseStoreExternalProfileAction
*
* @param ExternalProfileSite $profileSite
* @param array $entries
* @return void
* @return void
*/
protected function preloadResources(ExternalProfileSite $profileSite, array $entries): void
{
$externalResources = ExternalResource::query()
->where(ExternalResource::ATTRIBUTE_SITE, $profileSite->getResourceSite()->value)
->whereIn(ExternalResource::ATTRIBUTE_EXTERNAL_ID, Arr::pluck($entries, 'external_id'))
->with(ExternalResource::RELATION_ANIME)
->get()
->mapWithKeys(fn (ExternalResource $resource) => [$resource->external_id => $resource->anime]);
$this->resources = $externalResources;
$this->resources = Cache::flexible("externalprofile_resources", [60, 300], function () use ($profileSite, $entries) {
return ExternalResource::query()
->where(ExternalResource::ATTRIBUTE_SITE, $profileSite->getResourceSite()->value)
->whereIn(ExternalResource::ATTRIBUTE_EXTERNAL_ID, Arr::pluck($entries, 'external_id'))
->with(ExternalResource::RELATION_ANIME)
->get()
->mapWithKeys(fn (ExternalResource $resource) => [$resource->external_id => $resource->anime]);
});
}
/**
@@ -8,6 +8,7 @@ use App\Actions\Models\Wiki\ApiAction;
use App\Enums\Models\Wiki\AnimeSynonymType;
use App\Enums\Models\Wiki\ImageFacet;
use App\Enums\Models\Wiki\ResourceSite;
use App\Models\Wiki\Anime;
use App\Models\Wiki\ExternalResource;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Support\Arr;
@@ -31,7 +32,7 @@ class AnilistAnimeApiAction extends ApiAction
/**
* Set the response after the request.
*
* @param BelongsToMany<ExternalResource> $resources
* @param BelongsToMany<ExternalResource, Anime> $resources
* @return static
*/
public function handle(BelongsToMany $resources): static
@@ -127,7 +128,7 @@ class AnilistAnimeApiAction extends ApiAction
/**
* Get the available sites to backfill.
*
*
* @return array
*/
protected function getResourcesMapping(): array
@@ -6,6 +6,7 @@ namespace App\Actions\Models\Wiki\Anime\ApiAction;
use App\Actions\Models\Wiki\ApiAction;
use App\Enums\Models\Wiki\ResourceSite;
use App\Models\Wiki\Anime;
use App\Models\Wiki\ExternalResource;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Support\Arr;
@@ -29,7 +30,7 @@ class JikanAnimeApiAction extends ApiAction
/**
* Set the response after the request.
*
* @param BelongsToMany<ExternalResource> $resources
* @param BelongsToMany<ExternalResource, Anime> $resources
* @return static
*/
public function handle(BelongsToMany $resources): static
@@ -78,7 +79,7 @@ class JikanAnimeApiAction extends ApiAction
/**
* Get the available sites to backfill.
*
*
* @return array
*/
protected function getResourcesMapping(): array
@@ -6,6 +6,7 @@ namespace App\Actions\Models\Wiki\Anime\ApiAction;
use App\Actions\Models\Wiki\ApiAction;
use App\Enums\Models\Wiki\ResourceSite;
use App\Models\Wiki\Anime;
use App\Models\Wiki\ExternalResource;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Support\Facades\Http;
@@ -28,7 +29,7 @@ class LivechartAnimeApiAction extends ApiAction
/**
* Set the response after the request.
*
* @param BelongsToMany<ExternalResource> $resources
* @param BelongsToMany<ExternalResource, Anime> $resources
* @return static
*/
public function handle(BelongsToMany $resources): static
@@ -6,6 +6,7 @@ namespace App\Actions\Models\Wiki\Anime\ApiAction;
use App\Actions\Models\Wiki\ApiAction;
use App\Enums\Models\Wiki\ResourceSite;
use App\Models\Wiki\Anime;
use App\Models\Wiki\ExternalResource;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Support\Arr;
@@ -30,7 +31,7 @@ class MalAnimeApiAction extends ApiAction
/**
* Set the response after the request.
*
* @param BelongsToMany<ExternalResource> $resources
* @param BelongsToMany<ExternalResource, Anime> $resources
* @return static
*/
public function handle(BelongsToMany $resources): static
+5 -1
View File
@@ -5,7 +5,11 @@ declare(strict_types=1);
namespace App\Actions\Models\Wiki;
use App\Enums\Models\Wiki\ResourceSite;
use App\Models\BaseModel;
use App\Models\Wiki\Anime;
use App\Models\Wiki\ExternalResource;
use App\Models\Wiki\Studio;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Support\Arr;
@@ -39,7 +43,7 @@ abstract class ApiAction
/**
* Set the response after the request.
*
* @param BelongsToMany<ExternalResource> $resources
* @param BelongsToMany $resources
* @return static
*/
abstract public function handle(BelongsToMany $resources): static;
@@ -8,6 +8,7 @@ use App\Actions\Models\Wiki\ApiAction;
use App\Enums\Models\Wiki\ImageFacet;
use App\Enums\Models\Wiki\ResourceSite;
use App\Models\Wiki\ExternalResource;
use App\Models\Wiki\Studio;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
/**
@@ -28,7 +29,7 @@ class MalStudioApiAction extends ApiAction
/**
* Set the response after the request.
*
* @param BelongsToMany<ExternalResource> $resources
* @param BelongsToMany<ExternalResource, Studio> $resources
* @return static
*/
public function handle(BelongsToMany $resources): static
@@ -128,15 +128,15 @@ class UploadVideoTableAction extends UploadTableAction
->label(__('filament.fields.video.overlap.name'))
->helperText(__('filament.fields.video.overlap.help'))
->options(VideoOverlap::asSelectArray())
->nullable()
->rules(['nullable', new Enum(VideoOverlap::class)]),
->required()
->rules(['required', new Enum(VideoOverlap::class)]),
Select::make(Video::ATTRIBUTE_SOURCE)
->label(__('filament.fields.video.source.name'))
->helperText(__('filament.fields.video.source.help'))
->options(VideoSource::asSelectArray())
->nullable()
->rules(['nullable', new Enum(VideoSource::class)]),
->required()
->rules(['required', new Enum(VideoSource::class)]),
],
)
),
+7 -2
View File
@@ -6,6 +6,7 @@ namespace App\Filament\Tabs;
use Filament\Resources\Components\Tab;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Facades\Cache;
/**
* Class BaseTab.
@@ -41,7 +42,9 @@ abstract class BaseTab extends Tab
*/
public function modifyQuery(Builder $query): Builder
{
return $this->modifyQuery($query);
return Cache::flexible("filament_query_{$this->getKey()}", [15, 60], function () use ($query) {
return $this->modifyQuery($query);
});
}
/**
@@ -51,7 +54,9 @@ abstract class BaseTab extends Tab
*/
public function getBadge(): int
{
return $this->getBadge();
return Cache::flexible("filament_badge_{$this->getKey()}", [15, 60], function () {
return $this->getBadge();
});
}
/**
+8 -5
View File
@@ -6,6 +6,7 @@ namespace App\Filament\Widgets;
use Flowframe\Trend\Trend;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Cache;
use Leandrocfe\FilamentApexCharts\Widgets\ApexChartWidget;
/**
@@ -17,16 +18,18 @@ class BaseChartWidget extends ApexChartWidget
/**
* Get the resources count created per month.
*
*
* @param class-string $model
* @return Collection
*/
protected function perMonth(string $model): Collection
{
return Trend::model($model)
->between(now()->addMonths(-11)->startOfMonth(), now()->endOfMonth())
->perMonth()
->count();
return Cache::flexible("filament_chart_$model", [300, 1200], function () use ($model) {
return Trend::model($model)
->between(now()->addMonths(-11)->startOfMonth(), now()->endOfMonth())
->perMonth()
->count();
});
}
/**
+2 -2
View File
@@ -20,7 +20,7 @@ use Throwable;
/**
* Class ActionLog.
*
*
* @property int $id
* @property string $batch_id
* @property string $name
@@ -145,7 +145,7 @@ class ActionLog extends Model implements Nameable, HasSubtitle
/**
* Get the user that initiated the action.
*
* @return BelongsTo<User, ActionLog>
* @return BelongsTo<User, $this>
*/
public function user(): BelongsTo
{
+3 -3
View File
@@ -134,7 +134,7 @@ class FeaturedTheme extends BaseModel
/**
* Get the user that recommended the featured theme.
*
* @return BelongsTo<User, FeaturedTheme>
* @return BelongsTo<User, $this>
*/
public function user(): BelongsTo
{
@@ -144,7 +144,7 @@ class FeaturedTheme extends BaseModel
/**
* Get the entry for the featured video.
*
* @return BelongsTo<AnimeThemeEntry, FeaturedTheme>
* @return BelongsTo<AnimeThemeEntry, $this>
*/
public function animethemeentry(): BelongsTo
{
@@ -154,7 +154,7 @@ class FeaturedTheme extends BaseModel
/**
* Get the video to feature.
*
* @return BelongsTo<Video, FeaturedTheme>
* @return BelongsTo<Video, $this>
*/
public function video(): BelongsTo
{
+3 -3
View File
@@ -221,7 +221,7 @@ class User extends Authenticatable implements MustVerifyEmail, Nameable, HasSubt
/**
* Get the playlists that belong to the user.
*
* @return HasMany<Playlist>
* @return HasMany<Playlist, $this>
*/
public function playlists(): HasMany
{
@@ -231,7 +231,7 @@ class User extends Authenticatable implements MustVerifyEmail, Nameable, HasSubt
/**
* Get the playlists that belong to the user.
*
* @return HasMany<ExternalProfile>
* @return HasMany<ExternalProfile, $this>
*/
public function externalprofiles(): HasMany
{
@@ -241,7 +241,7 @@ class User extends Authenticatable implements MustVerifyEmail, Nameable, HasSubt
/**
* Get the action logs that the user has executed.
*
* @return HasMany<ActionLog>
* @return HasMany<ActionLog, $this>
*/
public function actionlogs(): HasMany
{
+1 -1
View File
@@ -105,7 +105,7 @@ class DiscordThread extends BaseModel
/**
* Gets the anime that the thread uses.
*
* @return BelongsTo<Anime, DiscordThread>
* @return BelongsTo<Anime, $this>
*/
public function anime(): BelongsTo
{
+2 -2
View File
@@ -133,7 +133,7 @@ class ExternalEntry extends BaseModel
/**
* Get the anime that owns the user external entry.
*
* @return BelongsTo<Anime, ExternalEntry>
* @return BelongsTo<Anime, $this>
*/
public function anime(): BelongsTo
{
@@ -143,7 +143,7 @@ class ExternalEntry extends BaseModel
/**
* Get the user profile that owns the user profile.
*
* @return BelongsTo<ExternalProfile, ExternalEntry>
* @return BelongsTo<ExternalProfile, $this>
*/
public function externalprofile(): BelongsTo
{
+1 -1
View File
@@ -118,7 +118,7 @@ class ExternalToken extends BaseModel
/**
* Get the external profile that owns the external token.
*
* @return BelongsTo<ExternalProfile, ExternalToken>
* @return BelongsTo<ExternalProfile, $this>
*/
public function externalprofile(): BelongsTo
{
+4 -4
View File
@@ -38,7 +38,7 @@ use Illuminate\Support\Facades\Date;
* @property int|null $user_id
* @property User|null $user
* @property ExternalProfileVisibility $visibility
*
*
* @method static ExternalProfileFactory factory(...$parameters)
*/
class ExternalProfile extends BaseModel
@@ -190,7 +190,7 @@ class ExternalProfile extends BaseModel
/**
* Get the entries for the profile.
*
* @return HasMany<ExternalEntry>
* @return HasMany<ExternalEntry, $this>
*/
public function externalentries(): HasMany
{
@@ -200,7 +200,7 @@ class ExternalProfile extends BaseModel
/**
* Get the user that owns the profile.
*
* @return BelongsTo<User, ExternalProfile>
* @return BelongsTo<User, $this>
*/
public function user(): BelongsTo
{
@@ -210,7 +210,7 @@ class ExternalProfile extends BaseModel
/**
* Get the external token that the external profile owns.
*
* @return HasOne<ExternalToken>
* @return HasOne<ExternalToken, $this>
*/
public function externaltoken(): HasOne
{
+5 -5
View File
@@ -175,7 +175,7 @@ class Playlist extends BaseModel implements HasHashids, Viewable
/**
* Get the user that owns the playlist.
*
* @return BelongsTo<User, Playlist>
* @return BelongsTo<User, $this>
*/
public function user(): BelongsTo
{
@@ -185,7 +185,7 @@ class Playlist extends BaseModel implements HasHashids, Viewable
/**
* Get the first track of the playlist.
*
* @return BelongsTo<PlaylistTrack, Playlist>
* @return BelongsTo<PlaylistTrack, $this>
*/
public function first(): BelongsTo
{
@@ -195,7 +195,7 @@ class Playlist extends BaseModel implements HasHashids, Viewable
/**
* Get the last track of the playlist.
*
* @return BelongsTo<PlaylistTrack, Playlist>
* @return BelongsTo<PlaylistTrack, $this>
*/
public function last(): BelongsTo
{
@@ -205,7 +205,7 @@ class Playlist extends BaseModel implements HasHashids, Viewable
/**
* Get the images for the playlist.
*
* @return BelongsToMany<Image>
* @return BelongsToMany<Image, $this>
*/
public function images(): BelongsToMany
{
@@ -218,7 +218,7 @@ class Playlist extends BaseModel implements HasHashids, Viewable
/**
* Get the tracks that comprise the playlist.
*
* @return HasMany<PlaylistTrack>
* @return HasMany<PlaylistTrack, $this>
*/
public function tracks(): HasMany
{
+5 -5
View File
@@ -156,7 +156,7 @@ class PlaylistTrack extends BaseModel implements HasHashids
/**
* Get the entry of the track.
*
* @return BelongsTo<AnimeThemeEntry, PlaylistTrack>
* @return BelongsTo<AnimeThemeEntry, $this>
*/
public function animethemeentry(): BelongsTo
{
@@ -166,7 +166,7 @@ class PlaylistTrack extends BaseModel implements HasHashids
/**
* Get the playlist the track belongs to.
*
* @return BelongsTo<Playlist, PlaylistTrack>
* @return BelongsTo<Playlist, $this>
*/
public function playlist(): BelongsTo
{
@@ -176,7 +176,7 @@ class PlaylistTrack extends BaseModel implements HasHashids
/**
* Get the previous track.
*
* @return BelongsTo<PlaylistTrack, PlaylistTrack>
* @return BelongsTo<PlaylistTrack, $this>
*/
public function previous(): BelongsTo
{
@@ -186,7 +186,7 @@ class PlaylistTrack extends BaseModel implements HasHashids
/**
* Get the next track.
*
* @return BelongsTo<PlaylistTrack, PlaylistTrack>
* @return BelongsTo<PlaylistTrack, $this>
*/
public function next(): BelongsTo
{
@@ -196,7 +196,7 @@ class PlaylistTrack extends BaseModel implements HasHashids
/**
* Get the video of the track.
*
* @return BelongsTo<Video, PlaylistTrack>
* @return BelongsTo<Video, $this>
*/
public function video(): BelongsTo
{
+8 -8
View File
@@ -199,7 +199,7 @@ class Anime extends BaseModel
/**
* Get the synonyms for the anime.
*
* @return HasMany<AnimeSynonym>
* @return HasMany<AnimeSynonym, $this>
*/
public function animesynonyms(): HasMany
{
@@ -209,7 +209,7 @@ class Anime extends BaseModel
/**
* Get the discord thread that the anime owns.
*
* @return HasOne<DiscordThread>
* @return HasOne<DiscordThread, $this>
*/
public function discordthread(): HasOne
{
@@ -219,7 +219,7 @@ class Anime extends BaseModel
/**
* Get the series the anime is included in.
*
* @return BelongsToMany<Series>
* @return BelongsToMany<Series, $this>
*/
public function series(): BelongsToMany
{
@@ -232,7 +232,7 @@ class Anime extends BaseModel
/**
* Get the themes for the anime.
*
* @return HasMany<AnimeTheme>
* @return HasMany<AnimeTheme, $this>
*/
public function animethemes(): HasMany
{
@@ -242,7 +242,7 @@ class Anime extends BaseModel
/**
* Get the resources for the anime.
*
* @return BelongsToMany<ExternalResource>
* @return BelongsToMany<ExternalResource, $this>
*/
public function resources(): BelongsToMany
{
@@ -256,7 +256,7 @@ class Anime extends BaseModel
/**
* Get the images for the anime.
*
* @return BelongsToMany<Image>
* @return BelongsToMany<Image, $this>
*/
public function images(): BelongsToMany
{
@@ -269,7 +269,7 @@ class Anime extends BaseModel
/**
* Get the studios that produced the anime.
*
* @return BelongsToMany<Studio>
* @return BelongsToMany<Studio, $this>
*/
public function studios(): BelongsToMany
{
@@ -282,7 +282,7 @@ class Anime extends BaseModel
/**
* Get the entries for the anime.
*
* @return HasMany<ExternalEntry>
* @return HasMany<ExternalEntry, $this>
*/
public function externalentries(): HasMany
{
+1 -1
View File
@@ -114,7 +114,7 @@ class AnimeSynonym extends BaseModel
/**
* Gets the anime that owns the synonym.
*
* @return BelongsTo<Anime, AnimeSynonym>
* @return BelongsTo<Anime, $this>
*/
public function anime(): BelongsTo
{
+4 -4
View File
@@ -178,7 +178,7 @@ class AnimeTheme extends BaseModel
/**
* Gets the anime that owns the theme.
*
* @return BelongsTo<Anime, AnimeTheme>
* @return BelongsTo<Anime, $this>
*/
public function anime(): BelongsTo
{
@@ -188,7 +188,7 @@ class AnimeTheme extends BaseModel
/**
* Gets the group that the theme uses.
*
* @return BelongsTo<Group, AnimeTheme>
* @return BelongsTo<Group, $this>
*/
public function group(): BelongsTo
{
@@ -198,7 +198,7 @@ class AnimeTheme extends BaseModel
/**
* Gets the song that the theme uses.
*
* @return BelongsTo<Song, AnimeTheme>
* @return BelongsTo<Song, $this>
*/
public function song(): BelongsTo
{
@@ -208,7 +208,7 @@ class AnimeTheme extends BaseModel
/**
* Get the entries for the theme.
*
* @return HasMany<AnimeThemeEntry>
* @return HasMany<AnimeThemeEntry, $this>
*/
public function animethemeentries(): HasMany
{
@@ -178,7 +178,7 @@ class AnimeThemeEntry extends BaseModel
/**
* Get the theme that owns the entry.
*
* @return BelongsTo<AnimeTheme, AnimeThemeEntry>
* @return BelongsTo<AnimeTheme, $this>
*/
public function animetheme(): BelongsTo
{
@@ -188,7 +188,7 @@ class AnimeThemeEntry extends BaseModel
/**
* Get the videos linked in the theme entry.
*
* @return BelongsToMany<Video>
* @return BelongsToMany<Video, $this>
*/
public function videos(): BelongsToMany
{
+5 -5
View File
@@ -153,7 +153,7 @@ class Artist extends BaseModel
/**
* Get the songs the artist has performed in.
*
* @return BelongsToMany<Song>
* @return BelongsToMany<Song, $this>
*/
public function songs(): BelongsToMany
{
@@ -167,7 +167,7 @@ class Artist extends BaseModel
/**
* Get the resources for the artist.
*
* @return BelongsToMany<ExternalResource>
* @return BelongsToMany<ExternalResource, $this>
*/
public function resources(): BelongsToMany
{
@@ -181,7 +181,7 @@ class Artist extends BaseModel
/**
* Get the members that comprise this group.
*
* @return BelongsToMany<Artist>
* @return BelongsToMany<Artist, $this>
*/
public function members(): BelongsToMany
{
@@ -195,7 +195,7 @@ class Artist extends BaseModel
/**
* Get the groups the artist has performed in.
*
* @return BelongsToMany<Artist>
* @return BelongsToMany<Artist, $this>
*/
public function groups(): BelongsToMany
{
@@ -209,7 +209,7 @@ class Artist extends BaseModel
/**
* Get the images for the artist.
*
* @return BelongsToMany<Image>
* @return BelongsToMany<Image, $this>
*/
public function images(): BelongsToMany
{
+1 -1
View File
@@ -173,7 +173,7 @@ class Audio extends BaseModel implements Streamable, Viewable
/**
* Get the videos that use this audio.
*
* @return HasMany<Video>
* @return HasMany<Video, $this>
*/
public function videos(): HasMany
{
+4 -4
View File
@@ -125,7 +125,7 @@ class ExternalResource extends BaseModel
/**
* Get the anime that reference this resource.
*
* @return BelongsToMany<Anime>
* @return BelongsToMany<Anime, $this>
*/
public function anime(): BelongsToMany
{
@@ -139,7 +139,7 @@ class ExternalResource extends BaseModel
/**
* Get the artists that reference this resource.
*
* @return BelongsToMany<Artist>
* @return BelongsToMany<Artist, $this>
*/
public function artists(): BelongsToMany
{
@@ -153,7 +153,7 @@ class ExternalResource extends BaseModel
/**
* Get the song that reference this resource.
*
* @return BelongsToMany<Song>
* @return BelongsToMany<Song, $this>
*/
public function songs(): BelongsToMany
{
@@ -167,7 +167,7 @@ class ExternalResource extends BaseModel
/**
* Get the studios that reference this resource.
*
* @return BelongsToMany<Studio>
* @return BelongsToMany<Studio, $this>
*/
public function studios(): BelongsToMany
{
+2 -2
View File
@@ -22,7 +22,7 @@ use Illuminate\Support\Collection;
* @property int $group_id
* @property string $name
* @property string $slug
*
*
* @method static GroupFactory factory(...$parameters)
*/
class Group extends BaseModel
@@ -99,7 +99,7 @@ class Group extends BaseModel
/**
* Get the themes for the group.
*
* @return HasMany<AnimeTheme>
* @return HasMany<AnimeTheme, $this>
*/
public function animethemes(): HasMany
{
+4 -4
View File
@@ -126,7 +126,7 @@ class Image extends BaseModel
/**
* Get the anime that use this image.
*
* @return BelongsToMany<Anime>
* @return BelongsToMany<Anime, $this>
*/
public function anime(): BelongsToMany
{
@@ -139,7 +139,7 @@ class Image extends BaseModel
/**
* Get the artists that use this image.
*
* @return BelongsToMany<Artist>
* @return BelongsToMany<Artist, $this>
*/
public function artists(): BelongsToMany
{
@@ -152,7 +152,7 @@ class Image extends BaseModel
/**
* Get the studios that use this image.
*
* @return BelongsToMany<Studio>
* @return BelongsToMany<Studio, $this>
*/
public function studios(): BelongsToMany
{
@@ -165,7 +165,7 @@ class Image extends BaseModel
/**
* Get the playlists that use this image.
*
* @return BelongsToMany<Playlist>
* @return BelongsToMany<Playlist, $this>
*/
public function playlists(): BelongsToMany
{
+1 -1
View File
@@ -111,7 +111,7 @@ class Series extends BaseModel
/**
* Get the anime included in the series.
*
* @return BelongsToMany<Anime>
* @return BelongsToMany<Anime, $this>
*/
public function anime(): BelongsToMany
{
+3 -3
View File
@@ -115,7 +115,7 @@ class Song extends BaseModel
/**
* Get the anime themes that use this song.
*
* @return HasMany<AnimeTheme>
* @return HasMany<AnimeTheme, $this>
*/
public function animethemes(): HasMany
{
@@ -125,7 +125,7 @@ class Song extends BaseModel
/**
* Get the artists included in the performance.
*
* @return BelongsToMany<Artist>
* @return BelongsToMany<Artist, $this>
*/
public function artists(): BelongsToMany
{
@@ -139,7 +139,7 @@ class Song extends BaseModel
/**
* Get the resources for the song.
*
* @return BelongsToMany<ExternalResource>
* @return BelongsToMany<ExternalResource, $this>
*/
public function resources(): BelongsToMany
{
+3 -3
View File
@@ -118,7 +118,7 @@ class Studio extends BaseModel
/**
* Get the anime that the studio produced.
*
* @return BelongsToMany<Anime>
* @return BelongsToMany<Anime, $this>
*/
public function anime(): BelongsToMany
{
@@ -131,7 +131,7 @@ class Studio extends BaseModel
/**
* Get the resources for the studio.
*
* @return BelongsToMany<ExternalResource>
* @return BelongsToMany<ExternalResource, $this>
*/
public function resources(): BelongsToMany
{
@@ -145,7 +145,7 @@ class Studio extends BaseModel
/**
* Get the images for the studio.
*
* @return BelongsToMany<Image>
* @return BelongsToMany<Image, $this>
*/
public function images(): BelongsToMany
{
+4 -4
View File
@@ -326,7 +326,7 @@ class Video extends BaseModel implements Streamable, Viewable
/**
* Get the related entries.
*
* @return BelongsToMany<AnimeThemeEntry>
* @return BelongsToMany<AnimeThemeEntry, $this>
*/
public function animethemeentries(): BelongsToMany
{
@@ -339,7 +339,7 @@ class Video extends BaseModel implements Streamable, Viewable
/**
* Gets the audio that the video uses.
*
* @return BelongsTo<Audio, Video>
* @return BelongsTo<Audio, $this>
*/
public function audio(): BelongsTo
{
@@ -349,7 +349,7 @@ class Video extends BaseModel implements Streamable, Viewable
/**
* Get the script that the video owns.
*
* @return HasOne<VideoScript>
* @return HasOne<VideoScript, $this>
*/
public function videoscript(): HasOne
{
@@ -359,7 +359,7 @@ class Video extends BaseModel implements Streamable, Viewable
/**
* Get the tracks that use this video.
*
* @return HasMany<PlaylistTrack>
* @return HasMany<PlaylistTrack, $this>
*/
public function tracks(): HasMany
{
+1 -1
View File
@@ -94,7 +94,7 @@ class VideoScript extends BaseModel
/**
* Get the video that owns the script.
*
* @return BelongsTo<Video, VideoScript>
* @return BelongsTo<Video, $this>
*/
public function video(): BelongsTo
{
+2 -2
View File
@@ -77,7 +77,7 @@ class PlaylistImage extends BasePivot
/**
* Gets the playlist that owns the playlist image.
*
* @return BelongsTo<Playlist, PlaylistImage>
* @return BelongsTo<Playlist, $this>
*/
public function playlist(): BelongsTo
{
@@ -87,7 +87,7 @@ class PlaylistImage extends BasePivot
/**
* Gets the image that owns the playlist image.
*
* @return BelongsTo<Image, PlaylistImage>
* @return BelongsTo<Image, $this>
*/
public function image(): BelongsTo
{
+2 -2
View File
@@ -77,7 +77,7 @@ class AnimeImage extends BasePivot
/**
* Gets the anime that owns the anime image.
*
* @return BelongsTo<Anime, AnimeImage>
* @return BelongsTo<Anime, $this>
*/
public function anime(): BelongsTo
{
@@ -87,7 +87,7 @@ class AnimeImage extends BasePivot
/**
* Gets the image that owns the anime image.
*
* @return BelongsTo<Image, AnimeImage>
* @return BelongsTo<Image, $this>
*/
public function image(): BelongsTo
{
+2 -2
View File
@@ -82,7 +82,7 @@ class AnimeResource extends BasePivot
/**
* Gets the anime that owns the anime resource.
*
* @return BelongsTo<Anime, AnimeResource>
* @return BelongsTo<Anime, $this>
*/
public function anime(): BelongsTo
{
@@ -92,7 +92,7 @@ class AnimeResource extends BasePivot
/**
* Gets the resource that owns the anime resource.
*
* @return BelongsTo<ExternalResource, AnimeResource>
* @return BelongsTo<ExternalResource, $this>
*/
public function resource(): BelongsTo
{
+2 -2
View File
@@ -77,7 +77,7 @@ class AnimeSeries extends BasePivot
/**
* Gets the anime that owns the anime series.
*
* @return BelongsTo<Anime, AnimeSeries>
* @return BelongsTo<Anime, $this>
*/
public function anime(): BelongsTo
{
@@ -87,7 +87,7 @@ class AnimeSeries extends BasePivot
/**
* Gets the series that owns the anime series.
*
* @return BelongsTo<Series, AnimeSeries>
* @return BelongsTo<Series, $this>
*/
public function series(): BelongsTo
{
+2 -2
View File
@@ -77,7 +77,7 @@ class AnimeStudio extends BasePivot
/**
* Gets the anime that owns the anime studio.
*
* @return BelongsTo<Anime, AnimeStudio>
* @return BelongsTo<Anime, $this>
*/
public function anime(): BelongsTo
{
@@ -87,7 +87,7 @@ class AnimeStudio extends BasePivot
/**
* Gets the studio that owns the anime studio.
*
* @return BelongsTo<Studio, AnimeStudio>
* @return BelongsTo<Studio, $this>
*/
public function studio(): BelongsTo
{
+2 -2
View File
@@ -81,7 +81,7 @@ class AnimeThemeEntryVideo extends BasePivot
/**
* Gets the video that owns the video entry.
*
* @return BelongsTo<Video, AnimeThemeEntryVideo>
* @return BelongsTo<Video, $this>
*/
public function video(): BelongsTo
{
@@ -91,7 +91,7 @@ class AnimeThemeEntryVideo extends BasePivot
/**
* Gets the entry that owns the video entry.
*
* @return BelongsTo<AnimeThemeEntry, AnimeThemeEntryVideo>
* @return BelongsTo<AnimeThemeEntry, $this>
*/
public function animethemeentry(): BelongsTo
{
+2 -2
View File
@@ -77,7 +77,7 @@ class ArtistImage extends BasePivot
/**
* Gets the artist that owns the artist image.
*
* @return BelongsTo<Artist, ArtistImage>
* @return BelongsTo<Artist, $this>
*/
public function artist(): BelongsTo
{
@@ -87,7 +87,7 @@ class ArtistImage extends BasePivot
/**
* Gets the image that owns the artist image.
*
* @return BelongsTo<Image, ArtistImage>
* @return BelongsTo<Image, $this>
*/
public function image(): BelongsTo
{
+2 -2
View File
@@ -84,7 +84,7 @@ class ArtistMember extends BasePivot
/**
* Gets the artist that owns the artist member.
*
* @return BelongsTo<Artist, ArtistMember>
* @return BelongsTo<Artist, $this>
*/
public function artist(): BelongsTo
{
@@ -94,7 +94,7 @@ class ArtistMember extends BasePivot
/**
* Gets the member that owns the artist member.
*
* @return BelongsTo<Artist, ArtistMember>
* @return BelongsTo<Artist, $this>
*/
public function member(): BelongsTo
{
+2 -2
View File
@@ -82,7 +82,7 @@ class ArtistResource extends BasePivot
/**
* Gets the artist that owns the artist resource.
*
* @return BelongsTo<Artist, ArtistResource>
* @return BelongsTo<Artist, $this>
*/
public function artist(): BelongsTo
{
@@ -92,7 +92,7 @@ class ArtistResource extends BasePivot
/**
* Gets the resource that owns the artist resource.
*
* @return BelongsTo<ExternalResource, ArtistResource>
* @return BelongsTo<ExternalResource, $this>
*/
public function resource(): BelongsTo
{
+2 -2
View File
@@ -85,7 +85,7 @@ class ArtistSong extends BasePivot
/**
* Gets the artist that owns the artist song.
*
* @return BelongsTo<Artist, ArtistSong>
* @return BelongsTo<Artist, $this>
*/
public function artist(): BelongsTo
{
@@ -95,7 +95,7 @@ class ArtistSong extends BasePivot
/**
* Gets the song that owns the artist song.
*
* @return BelongsTo<Song, ArtistSong>
* @return BelongsTo<Song, $this>
*/
public function song(): BelongsTo
{
+2 -2
View File
@@ -82,7 +82,7 @@ class SongResource extends BasePivot
/**
* Gets the song that owns the anime resource.
*
* @return BelongsTo<Song, SongResource>
* @return BelongsTo<Song, $this>
*/
public function song(): BelongsTo
{
@@ -92,7 +92,7 @@ class SongResource extends BasePivot
/**
* Gets the resource that owns the anime resource.
*
* @return BelongsTo<ExternalResource, SongResource>
* @return BelongsTo<ExternalResource, $this>
*/
public function resource(): BelongsTo
{
+2 -2
View File
@@ -77,7 +77,7 @@ class StudioImage extends BasePivot
/**
* Gets the studio that owns the studio image.
*
* @return BelongsTo<Studio, StudioImage>
* @return BelongsTo<Studio, $this>
*/
public function studio(): BelongsTo
{
@@ -87,7 +87,7 @@ class StudioImage extends BasePivot
/**
* Gets the image that owns the studio image.
*
* @return BelongsTo<Image, StudioImage>
* @return BelongsTo<Image, $this>
*/
public function image(): BelongsTo
{
+2 -2
View File
@@ -82,7 +82,7 @@ class StudioResource extends BasePivot
/**
* Gets the studio that owns the studio resource.
*
* @return BelongsTo<Studio, StudioResource>
* @return BelongsTo<Studio, $this>
*/
public function studio(): BelongsTo
{
@@ -92,7 +92,7 @@ class StudioResource extends BasePivot
/**
* Gets the resource that owns the studio resource.
*
* @return BelongsTo<ExternalResource, StudioResource>
* @return BelongsTo<ExternalResource, $this>
*/
public function resource(): BelongsTo
{
+1
View File
@@ -57,6 +57,7 @@
"vinkla/hashids": "^12.0"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.14",
"brianium/paratest": "^7.0",
"larastan/larastan": "^2.9",
"laravel/pint": "^1.6",
Generated
+409 -247
View File
File diff suppressed because it is too large Load Diff
+329
View File
@@ -0,0 +1,329 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Debugbar Settings
|--------------------------------------------------------------------------
|
| Debugbar is enabled by default, when debug is set to true in app.php.
| You can override the value by setting enable to true or false instead of null.
|
| You can provide an array of URI's that must be ignored (eg. 'api/*')
|
*/
'enabled' => env('DEBUGBAR_ENABLED', false),
'hide_empty_tabs' => false, // Hide tabs until they have content
'except' => [
'telescope*',
'horizon*',
],
/*
|--------------------------------------------------------------------------
| Storage settings
|--------------------------------------------------------------------------
|
| DebugBar stores data for session/ajax requests.
| You can disable this, so the debugbar stores data in headers/session,
| but this can cause problems with large data collectors.
| By default, file storage (in the storage folder) is used. Redis and PDO
| can also be used. For PDO, run the package migrations first.
|
| Warning: Enabling storage.open will allow everyone to access previous
| request, do not enable open storage in publicly available environments!
| Specify a callback if you want to limit based on IP or authentication.
| Leaving it to null will allow localhost only.
*/
'storage' => [
'enabled' => true,
'open' => env('DEBUGBAR_OPEN_STORAGE'), // bool/callback.
'driver' => 'file', // redis, file, pdo, socket, custom
'path' => storage_path('debugbar'), // For file driver
'connection' => null, // Leave null for default connection (Redis/PDO)
'provider' => '', // Instance of StorageInterface for custom driver
'hostname' => '127.0.0.1', // Hostname to use with the "socket" driver
'port' => 2304, // Port to use with the "socket" driver
],
/*
|--------------------------------------------------------------------------
| Editor
|--------------------------------------------------------------------------
|
| Choose your preferred editor to use when clicking file name.
|
| Supported: "phpstorm", "vscode", "vscode-insiders", "vscode-remote",
| "vscode-insiders-remote", "vscodium", "textmate", "emacs",
| "sublime", "atom", "nova", "macvim", "idea", "netbeans",
| "xdebug", "espresso"
|
*/
'editor' => env('DEBUGBAR_EDITOR') ?: env('IGNITION_EDITOR', 'phpstorm'),
/*
|--------------------------------------------------------------------------
| Remote Path Mapping
|--------------------------------------------------------------------------
|
| If you are using a remote dev server, like Laravel Homestead, Docker, or
| even a remote VPS, it will be necessary to specify your path mapping.
|
| Leaving one, or both of these, empty or null will not trigger the remote
| URL changes and Debugbar will treat your editor links as local files.
|
| "remote_sites_path" is an absolute base path for your sites or projects
| in Homestead, Vagrant, Docker, or another remote development server.
|
| Example value: "/home/vagrant/Code"
|
| "local_sites_path" is an absolute base path for your sites or projects
| on your local computer where your IDE or code editor is running on.
|
| Example values: "/Users/<name>/Code", "C:\Users\<name>\Documents\Code"
|
*/
'remote_sites_path' => env('DEBUGBAR_REMOTE_SITES_PATH'),
'local_sites_path' => env('DEBUGBAR_LOCAL_SITES_PATH', env('IGNITION_LOCAL_SITES_PATH')),
/*
|--------------------------------------------------------------------------
| Vendors
|--------------------------------------------------------------------------
|
| Vendor files are included by default, but can be set to false.
| This can also be set to 'js' or 'css', to only include javascript or css vendor files.
| Vendor files are for css: font-awesome (including fonts) and highlight.js (css files)
| and for js: jquery and highlight.js
| So if you want syntax highlighting, set it to true.
| jQuery is set to not conflict with existing jQuery scripts.
|
*/
'include_vendors' => true,
/*
|--------------------------------------------------------------------------
| Capture Ajax Requests
|--------------------------------------------------------------------------
|
| The Debugbar can capture Ajax requests and display them. If you don't want this (ie. because of errors),
| you can use this option to disable sending the data through the headers.
|
| Optionally, you can also send ServerTiming headers on ajax requests for the Chrome DevTools.
|
| Note for your request to be identified as ajax requests they must either send the header
| X-Requested-With with the value XMLHttpRequest (most JS libraries send this), or have application/json as a Accept header.
|
| By default `ajax_handler_auto_show` is set to true allowing ajax requests to be shown automatically in the Debugbar.
| Changing `ajax_handler_auto_show` to false will prevent the Debugbar from reloading.
*/
'capture_ajax' => true,
'add_ajax_timing' => false,
'ajax_handler_auto_show' => true,
'ajax_handler_enable_tab' => true,
/*
|--------------------------------------------------------------------------
| Custom Error Handler for Deprecated warnings
|--------------------------------------------------------------------------
|
| When enabled, the Debugbar shows deprecated warnings for Symfony components
| in the Messages tab.
|
*/
'error_handler' => false,
/*
|--------------------------------------------------------------------------
| Clockwork integration
|--------------------------------------------------------------------------
|
| The Debugbar can emulate the Clockwork headers, so you can use the Chrome
| Extension, without the server-side code. It uses Debugbar collectors instead.
|
*/
'clockwork' => false,
/*
|--------------------------------------------------------------------------
| DataCollectors
|--------------------------------------------------------------------------
|
| Enable/disable DataCollectors
|
*/
'collectors' => [
'phpinfo' => true, // Php version
'messages' => true, // Messages
'time' => true, // Time Datalogger
'memory' => true, // Memory usage
'exceptions' => true, // Exception displayer
'log' => true, // Logs from Monolog (merged in messages if enabled)
'db' => true, // Show database (PDO) queries and bindings
'views' => true, // Views with their data
'route' => true, // Current route information
'auth' => false, // Display Laravel authentication status
'gate' => true, // Display Laravel Gate checks
'session' => true, // Display session data
'symfony_request' => true, // Only one can be enabled..
'mail' => false, // Catch mail messages
'laravel' => false, // Laravel version and environment
'events' => false, // All events fired
'default_request' => false, // Regular or special Symfony request logger
'logs' => false, // Add the latest log messages
'files' => false, // Show the included files
'config' => false, // Display config settings
'cache' => true, // Display cache events
'models' => true, // Display models
'livewire' => true, // Display Livewire (when available)
'jobs' => false, // Display dispatched jobs
'pennant' => true, // Display Pennant feature flags
],
/*
|--------------------------------------------------------------------------
| Extra options
|--------------------------------------------------------------------------
|
| Configure some DataCollectors
|
*/
'options' => [
'time' => [
'memory_usage' => false, // Calculated by subtracting memory start and end, it may be inaccurate
],
'messages' => [
'trace' => true, // Trace the origin of the debug message
],
'memory' => [
'reset_peak' => false, // run memory_reset_peak_usage before collecting
'with_baseline' => false, // Set boot memory usage as memory peak baseline
'precision' => 0, // Memory rounding precision
],
'auth' => [
'show_name' => true, // Also show the users name/email in the debugbar
'show_guards' => true, // Show the guards that are used
],
'db' => [
'with_params' => true, // Render SQL with the parameters substituted
'exclude_paths' => [ // Paths to exclude entirely from the collector
// 'vendor/laravel/framework/src/Illuminate/Session', // Exclude sessions queries
],
'backtrace' => true, // Use a backtrace to find the origin of the query in your files.
'backtrace_exclude_paths' => [], // Paths to exclude from backtrace. (in addition to defaults)
'timeline' => false, // Add the queries to the timeline
'duration_background' => true, // Show shaded background on each query relative to how long it took to execute.
'explain' => [ // Show EXPLAIN output on queries
'enabled' => false,
],
'hints' => false, // Show hints for common mistakes
'show_copy' => true, // Show copy button next to the query,
'slow_threshold' => false, // Only track queries that last longer than this time in ms
'memory_usage' => false, // Show queries memory usage
'soft_limit' => 100, // After the soft limit, no parameters/backtrace are captured
'hard_limit' => 500, // After the hard limit, queries are ignored
],
'mail' => [
'timeline' => false, // Add mails to the timeline
'show_body' => true,
],
'views' => [
'timeline' => false, // Add the views to the timeline (Experimental)
'data' => false, //true for all data, 'keys' for only names, false for no parameters.
'group' => 50, // Group duplicate views. Pass value to auto-group, or true/false to force
'exclude_paths' => [ // Add the paths which you don't want to appear in the views
'vendor/filament' // Exclude Filament components by default
],
],
'route' => [
'label' => true, // show complete route on bar
],
'session' => [
'hiddens' => [], // hides sensitive values using array paths
],
'symfony_request' => [
'hiddens' => [], // hides sensitive values using array paths, example: request_request.password
],
'events' => [
'data' => false, // collect events data, listeners
],
'logs' => [
'file' => null,
],
'cache' => [
'values' => true, // collect cache values
],
],
/*
|--------------------------------------------------------------------------
| Inject Debugbar in Response
|--------------------------------------------------------------------------
|
| Usually, the debugbar is added just before </body>, by listening to the
| Response after the App is done. If you disable this, you have to add them
| in your template yourself. See http://phpdebugbar.com/docs/rendering.html
|
*/
'inject' => true,
/*
|--------------------------------------------------------------------------
| DebugBar route prefix
|--------------------------------------------------------------------------
|
| Sometimes you want to set route prefix to be used by DebugBar to load
| its resources from. Usually the need comes from misconfigured web server or
| from trying to overcome bugs like this: http://trac.nginx.org/nginx/ticket/97
|
*/
'route_prefix' => '_debugbar',
/*
|--------------------------------------------------------------------------
| DebugBar route middleware
|--------------------------------------------------------------------------
|
| Additional middleware to run on the Debugbar routes
*/
'route_middleware' => [],
/*
|--------------------------------------------------------------------------
| DebugBar route domain
|--------------------------------------------------------------------------
|
| By default DebugBar route served from the same domain that request served.
| To override default domain, specify it as a non-empty value.
*/
'route_domain' => null,
/*
|--------------------------------------------------------------------------
| DebugBar theme
|--------------------------------------------------------------------------
|
| Switches between light and dark theme. If set to auto it will respect system preferences
| Possible values: auto, light, dark
*/
'theme' => env('DEBUGBAR_THEME', 'auto'),
/*
|--------------------------------------------------------------------------
| Backtrace stack limit
|--------------------------------------------------------------------------
|
| By default, the DebugBar limits the number of frames returned by the 'debug_backtrace()' function.
| If you need larger stacktraces, you can increase this number. Setting it to 0 will result in no limit.
*/
'debug_backtrace_limit' => 50,
];
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,5 +1,5 @@
{
"/app.js": "/app.js?id=48ba33a2532e4b6ec718bc0f03b3f1e4",
"/app.js": "/app.js?id=99f84d421ae083196e0a45c3c310168b",
"/app-dark.css": "/app-dark.css?id=1ea407db56c5163ae29311f1f38eb7b9",
"/app.css": "/app.css?id=de4c978567bfd90b38d186937dee5ccf"
}
+2
View File
@@ -0,0 +1,2 @@
*
!.gitignore