Skip to content

Commit

Permalink
docs: added generics notation for eloquent relationships (#745)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyrch authored Sep 12, 2024
1 parent 84a0281 commit 326f828
Show file tree
Hide file tree
Showing 36 changed files with 92 additions and 92 deletions.
2 changes: 1 addition & 1 deletion app/Models/Admin/ActionLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public function actionable(): MorphTo
/**
* Get the user that initiated the action.
*
* @return BelongsTo
* @return BelongsTo<User, ActionLog>
*/
public function user(): BelongsTo
{
Expand Down
6 changes: 3 additions & 3 deletions app/Models/Admin/FeaturedTheme.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public function getSubtitle(): string
/**
* Get the user that recommended the featured theme.
*
* @return BelongsTo
* @return BelongsTo<User, FeaturedTheme>
*/
public function user(): BelongsTo
{
Expand All @@ -144,7 +144,7 @@ public function user(): BelongsTo
/**
* Get the entry for the featured video.
*
* @return BelongsTo
* @return BelongsTo<AnimeThemeEntry, FeaturedTheme>
*/
public function animethemeentry(): BelongsTo
{
Expand All @@ -154,7 +154,7 @@ public function animethemeentry(): BelongsTo
/**
* Get the video to feature.
*
* @return BelongsTo
* @return BelongsTo<Video, FeaturedTheme>
*/
public function video(): BelongsTo
{
Expand Down
6 changes: 3 additions & 3 deletions app/Models/Auth/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public function getFilamentAvatarUrl(): string
/**
* Get the playlists that belong to the user.
*
* @return HasMany
* @return HasMany<Playlist>
*/
public function playlists(): HasMany
{
Expand All @@ -231,7 +231,7 @@ public function playlists(): HasMany
/**
* Get the playlists that belong to the user.
*
* @return HasMany
* @return HasMany<ExternalProfile>
*/
public function externalprofiles(): HasMany
{
Expand All @@ -241,7 +241,7 @@ public function externalprofiles(): HasMany
/**
* Get the action logs that the user has executed.
*
* @return HasMany
* @return HasMany<ActionLog>
*/
public function actionlogs(): HasMany
{
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Discord/DiscordThread.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function getSubtitle(): string
/**
* Gets the anime that the thread uses.
*
* @return BelongsTo
* @return BelongsTo<Anime, DiscordThread>
*/
public function anime(): BelongsTo
{
Expand Down
4 changes: 2 additions & 2 deletions app/Models/List/External/ExternalEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public function getRouteKeyName(): string
/**
* Get the anime that owns the user external entry.
*
* @return BelongsTo
* @return BelongsTo<Anime, ExternalEntry>
*/
public function anime(): BelongsTo
{
Expand All @@ -143,7 +143,7 @@ public function anime(): BelongsTo
/**
* Get the user profile that owns the user profile.
*
* @return BelongsTo
* @return BelongsTo<ExternalProfile, ExternalEntry>
*/
public function externalprofile(): BelongsTo
{
Expand Down
2 changes: 1 addition & 1 deletion app/Models/List/External/ExternalToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function getRouteKeyName(): string
/**
* Get the external profile that owns the external token.
*
* @return BelongsTo
* @return BelongsTo<ExternalProfile, ExternalToken>
*/
public function externalprofile(): BelongsTo
{
Expand Down
6 changes: 3 additions & 3 deletions app/Models/List/ExternalProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public function isClaimed(): bool
/**
* Get the entries for the profile.
*
* @return HasMany
* @return HasMany<ExternalEntry>
*/
public function externalentries(): HasMany
{
Expand All @@ -190,7 +190,7 @@ public function externalentries(): HasMany
/**
* Get the user that owns the profile.
*
* @return BelongsTo
* @return BelongsTo<User, ExternalProfile>
*/
public function user(): BelongsTo
{
Expand All @@ -200,7 +200,7 @@ public function user(): BelongsTo
/**
* Get the external token that the external profile owns.
*
* @return HasOne
* @return HasOne<ExternalToken>
*/
public function externaltoken(): HasOne
{
Expand Down
10 changes: 5 additions & 5 deletions app/Models/List/Playlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public function shouldBeSearchable(): bool
/**
* Get the user that owns the playlist.
*
* @return BelongsTo
* @return BelongsTo<User, Playlist>
*/
public function user(): BelongsTo
{
Expand All @@ -185,7 +185,7 @@ public function user(): BelongsTo
/**
* Get the first track of the playlist.
*
* @return BelongsTo
* @return BelongsTo<PlaylistTrack, Playlist>
*/
public function first(): BelongsTo
{
Expand All @@ -195,7 +195,7 @@ public function first(): BelongsTo
/**
* Get the last track of the playlist.
*
* @return BelongsTo
* @return BelongsTo<PlaylistTrack, Playlist>
*/
public function last(): BelongsTo
{
Expand All @@ -205,7 +205,7 @@ public function last(): BelongsTo
/**
* Get the images for the playlist.
*
* @return BelongsToMany
* @return BelongsToMany<Image>
*/
public function images(): BelongsToMany
{
Expand All @@ -218,7 +218,7 @@ public function images(): BelongsToMany
/**
* Get the tracks that comprise the playlist.
*
* @return HasMany
* @return HasMany<PlaylistTrack>
*/
public function tracks(): HasMany
{
Expand Down
10 changes: 5 additions & 5 deletions app/Models/List/Playlist/PlaylistTrack.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public function getSubtitle(): string
/**
* Get the entry of the track.
*
* @return BelongsTo
* @return BelongsTo<AnimeThemeEntry, PlaylistTrack>
*/
public function animethemeentry(): BelongsTo
{
Expand All @@ -166,7 +166,7 @@ public function animethemeentry(): BelongsTo
/**
* Get the playlist the track belongs to.
*
* @return BelongsTo
* @return BelongsTo<Playlist, PlaylistTrack>
*/
public function playlist(): BelongsTo
{
Expand All @@ -176,7 +176,7 @@ public function playlist(): BelongsTo
/**
* Get the previous track.
*
* @return BelongsTo
* @return BelongsTo<PlaylistTrack, PlaylistTrack>
*/
public function previous(): BelongsTo
{
Expand All @@ -186,7 +186,7 @@ public function previous(): BelongsTo
/**
* Get the next track.
*
* @return BelongsTo
* @return BelongsTo<PlaylistTrack, PlaylistTrack>
*/
public function next(): BelongsTo
{
Expand All @@ -196,7 +196,7 @@ public function next(): BelongsTo
/**
* Get the video of the track.
*
* @return BelongsTo
* @return BelongsTo<Video, PlaylistTrack>
*/
public function video(): BelongsTo
{
Expand Down
16 changes: 8 additions & 8 deletions app/Models/Wiki/Anime.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public function getSubtitle(): string
/**
* Get the synonyms for the anime.
*
* @return HasMany
* @return HasMany<AnimeSynonym>
*/
public function animesynonyms(): HasMany
{
Expand All @@ -209,7 +209,7 @@ public function animesynonyms(): HasMany
/**
* Get the discord thread that the anime owns.
*
* @return HasOne
* @return HasOne<DiscordThread>
*/
public function discordthread(): HasOne
{
Expand All @@ -219,7 +219,7 @@ public function discordthread(): HasOne
/**
* Get the series the anime is included in.
*
* @return BelongsToMany
* @return BelongsToMany<Series>
*/
public function series(): BelongsToMany
{
Expand All @@ -232,7 +232,7 @@ public function series(): BelongsToMany
/**
* Get the themes for the anime.
*
* @return HasMany
* @return HasMany<AnimeTheme>
*/
public function animethemes(): HasMany
{
Expand All @@ -242,7 +242,7 @@ public function animethemes(): HasMany
/**
* Get the resources for the anime.
*
* @return BelongsToMany
* @return BelongsToMany<ExternalResource>
*/
public function resources(): BelongsToMany
{
Expand All @@ -256,7 +256,7 @@ public function resources(): BelongsToMany
/**
* Get the images for the anime.
*
* @return BelongsToMany
* @return BelongsToMany<Image>
*/
public function images(): BelongsToMany
{
Expand All @@ -269,7 +269,7 @@ public function images(): BelongsToMany
/**
* Get the studios that produced the anime.
*
* @return BelongsToMany
* @return BelongsToMany<Studio>
*/
public function studios(): BelongsToMany
{
Expand All @@ -282,7 +282,7 @@ public function studios(): BelongsToMany
/**
* Get the entries for the anime.
*
* @return HasMany
* @return HasMany<ExternalEntry>
*/
public function externalentries(): HasMany
{
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Wiki/Anime/AnimeSynonym.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public function getSubtitle(): string
/**
* Gets the anime that owns the synonym.
*
* @return BelongsTo
* @return BelongsTo<Anime, AnimeSynonym>
*/
public function anime(): BelongsTo
{
Expand Down
8 changes: 4 additions & 4 deletions app/Models/Wiki/Anime/AnimeTheme.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public function getSubtitle(): string
/**
* Gets the anime that owns the theme.
*
* @return BelongsTo
* @return BelongsTo<Anime, AnimeTheme>
*/
public function anime(): BelongsTo
{
Expand All @@ -188,7 +188,7 @@ public function anime(): BelongsTo
/**
* Gets the group that the theme uses.
*
* @return BelongsTo
* @return BelongsTo<Group, AnimeTheme>
*/
public function group(): BelongsTo
{
Expand All @@ -198,7 +198,7 @@ public function group(): BelongsTo
/**
* Gets the song that the theme uses.
*
* @return BelongsTo
* @return BelongsTo<Song, AnimeTheme>
*/
public function song(): BelongsTo
{
Expand All @@ -208,7 +208,7 @@ public function song(): BelongsTo
/**
* Get the entries for the theme.
*
* @return HasMany
* @return HasMany<AnimeThemeEntry>
*/
public function animethemeentries(): HasMany
{
Expand Down
4 changes: 2 additions & 2 deletions app/Models/Wiki/Anime/Theme/AnimeThemeEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public function getSubtitle(): string
/**
* Get the theme that owns the entry.
*
* @return BelongsTo
* @return BelongsTo<AnimeTheme, AnimeThemeEntry>
*/
public function animetheme(): BelongsTo
{
Expand All @@ -188,7 +188,7 @@ public function animetheme(): BelongsTo
/**
* Get the videos linked in the theme entry.
*
* @return BelongsToMany
* @return BelongsToMany<Video>
*/
public function videos(): BelongsToMany
{
Expand Down
10 changes: 5 additions & 5 deletions app/Models/Wiki/Artist.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public function getSubtitle(): string
/**
* Get the songs the artist has performed in.
*
* @return BelongsToMany
* @return BelongsToMany<Song>
*/
public function songs(): BelongsToMany
{
Expand All @@ -167,7 +167,7 @@ public function songs(): BelongsToMany
/**
* Get the resources for the artist.
*
* @return BelongsToMany
* @return BelongsToMany<ExternalResource>
*/
public function resources(): BelongsToMany
{
Expand All @@ -181,7 +181,7 @@ public function resources(): BelongsToMany
/**
* Get the members that comprise this group.
*
* @return BelongsToMany
* @return BelongsToMany<Artist>
*/
public function members(): BelongsToMany
{
Expand All @@ -195,7 +195,7 @@ public function members(): BelongsToMany
/**
* Get the groups the artist has performed in.
*
* @return BelongsToMany
* @return BelongsToMany<Artist>
*/
public function groups(): BelongsToMany
{
Expand All @@ -209,7 +209,7 @@ public function groups(): BelongsToMany
/**
* Get the images for the artist.
*
* @return BelongsToMany
* @return BelongsToMany<Image>
*/
public function images(): BelongsToMany
{
Expand Down
Loading

0 comments on commit 326f828

Please sign in to comment.