1<?php
2
3// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
4// See the LICENCE file in the repository root for full licence text.
5
6namespace App\Models;
7
8/**
9 * @property Artist $artist
10 * @property int|null $artist_id
11 * @property string|null $cover_url
12 * @property \Carbon\Carbon|null $created_at
13 * @property string $genre
14 * @property int $id
15 * @property string $title
16 * @property string|null $title_romanized
17 * @property \Illuminate\Database\Eloquent\Collection $tracks ArtistTrack
18 * @property \Carbon\Carbon|null $updated_at
19 * @property int $visible
20 */
21class ArtistAlbum extends Model
22{
23 protected $casts = [
24 'visible' => 'boolean',
25 ];
26
27 public function artist()
28 {
29 return $this->belongsTo(Artist::class);
30 }
31
32 public function tracks()
33 {
34 return $this->hasMany(ArtistTrack::class, 'album_id');
35 }
36
37 public function isNew()
38 {
39 return $this->created_at->isAfter(now()->subMonths(1));
40 }
41}