Library
extends BaseModel
in package
uses
HasFactory, HasSlug, HasLibraryStats, HasMeta
Table of Contents
Properties
- $dateFormat : mixed
- $fillable : mixed
- $meta : array<string|int, mixed>
- Dynamic meta properties that can be serialized
Methods
- albums() : mixed
- clearMeta() : self
- Clear all meta properties
- formatForException() : string
- getAllMeta() : array<string|int, mixed>
- Get all meta properties
- getDashboardData() : array<string|int, mixed>
- Get a summary dashboard for this library
- getDisk() : mixed
- getFormattedStats() : FormattedLibraryStats
- Get formatted library statistics and store them in meta
- getMeta() : T|null
- Get a typed meta property
- getMetaAsType() : T|null
- Get a meta property with type assertion
- getMetaKeys() : array<string|int, mixed>
- Get meta property names (keys)
- getRawStats() : LibraryStats
- Get raw library statistics and store them in meta
- getRouteKeyName() : string
- getSlugOptions() : SlugOptions
- Get the options for generating the slug.
- hasAnyMeta() : bool
- Check if any meta properties exist
- hasMeta() : bool
- Check if a meta property exists
- newEloquentBuilder() : mixed
- removeMeta() : self
- Remove a meta property
- setMeta() : self
- Set a meta property with type safety
- setMultipleMeta() : self
- Set multiple meta properties at once
- toArray() : array<string|int, mixed>
- Convert the model instance to an array including meta properties
- update() : mixed
- updateLastScan() : void
- users() : mixed
- formatBytes() : string
- Format bytes to human readable format
- formatDuration() : string
- Format duration in seconds to human readable format
- getStats() : array<string|int, mixed>
- Get comprehensive library statistics from database
Properties
$dateFormat
protected
mixed
$dateFormat
= 'Y-m-d H:i:sO'
$fillable
protected
mixed
$fillable
= ['name', 'slug', 'path', 'type', 'order', 'last_scan']
$meta
Dynamic meta properties that can be serialized
protected
array<string|int, mixed>
$meta
= []
Methods
albums()
public
albums() : mixed
clearMeta()
Clear all meta properties
public
clearMeta() : self
Return values
selfformatForException()
public
formatForException() : string
Return values
stringgetAllMeta()
Get all meta properties
public
getAllMeta() : array<string|int, mixed>
Return values
array<string|int, mixed>getDashboardData()
Get a summary dashboard for this library
public
getDashboardData() : array<string|int, mixed>
Return values
array<string|int, mixed>getDisk()
public
getDisk() : mixed
getFormattedStats()
Get formatted library statistics and store them in meta
public
getFormattedStats() : FormattedLibraryStats
Return values
FormattedLibraryStatsgetMeta()
Get a typed meta property
public
getMeta(MetaKey|string $key[, T|null $default = null ]) : T|null
Parameters
- $key : MetaKey|string
-
The meta property key
- $default : T|null = null
-
Default value if key doesn't exist
Tags
Return values
T|nullgetMetaAsType()
Get a meta property with type assertion
public
getMetaAsType(MetaKey|string $key, T> $type[, T|null $default = null ]) : T|null
Parameters
- $key : MetaKey|string
-
The meta property key
- $type : T>
-
Expected type class
- $default : T|null = null
-
Default value if key doesn't exist
Tags
Return values
T|nullgetMetaKeys()
Get meta property names (keys)
public
getMetaKeys() : array<string|int, mixed>
Return values
array<string|int, mixed>getRawStats()
Get raw library statistics and store them in meta
public
getRawStats() : LibraryStats
Return values
LibraryStatsgetRouteKeyName()
public
getRouteKeyName() : string
Return values
stringgetSlugOptions()
Get the options for generating the slug.
public
getSlugOptions() : SlugOptions
Return values
SlugOptionshasAnyMeta()
Check if any meta properties exist
public
hasAnyMeta() : bool
Return values
boolhasMeta()
Check if a meta property exists
public
hasMeta(MetaKey|string $key) : bool
Parameters
- $key : MetaKey|string
-
The meta property key
Return values
boolnewEloquentBuilder()
public
newEloquentBuilder(mixed $query) : mixed
Parameters
- $query : mixed
removeMeta()
Remove a meta property
public
removeMeta(MetaKey|string $key) : self
Parameters
- $key : MetaKey|string
-
The meta property key to remove
Return values
selfsetMeta()
Set a meta property with type safety
public
setMeta(MetaKey|string $key, T $value) : self
Parameters
- $key : MetaKey|string
-
The meta property key
- $value : T
-
The meta property value
Tags
Return values
selfsetMultipleMeta()
Set multiple meta properties at once
public
setMultipleMeta(array<string|int, mixed> $meta) : self
Parameters
- $meta : array<string|int, mixed>
Return values
selftoArray()
Convert the model instance to an array including meta properties
public
toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>update()
public
update([array<string|int, mixed> $attributes = [] ][, array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $attributes : array<string|int, mixed> = []
- $options : array<string|int, mixed> = []
updateLastScan()
public
updateLastScan([Carbon|null $date = null ]) : void
Parameters
- $date : Carbon|null = null
users()
public
users() : mixed
formatBytes()
Format bytes to human readable format
private
formatBytes(int $bytes) : string
Parameters
- $bytes : int
Return values
stringformatDuration()
Format duration in seconds to human readable format
private
formatDuration(int $seconds) : string
Parameters
- $seconds : int
Return values
stringgetStats()
Get comprehensive library statistics from database
private
getStats() : array<string|int, mixed>