Fix tests

This commit is contained in:
Phan An 2018-02-05 09:52:14 +01:00
parent 4ad5020b58
commit f472ff9ac8
2 changed files with 9 additions and 5 deletions

View file

@ -212,15 +212,17 @@ class Album extends Model
*/
public function getHasCoverAttribute()
{
if (!$this->attributes['cover']) {
$cover = array_get($this->attributes, 'cover');
if (!$cover) {
return false;
}
if ($this->attributes['cover'] === self::UNKNOWN_COVER) {
if ($cover === self::UNKNOWN_COVER) {
return false;
}
return file_exists(public_path("/public/img/covers/{$this->attributes['cover']}"));
return file_exists(public_path("/public/img/covers/$cover"));
}
/**

View file

@ -188,11 +188,13 @@ class Artist extends Model
public function getHasImageAttribute()
{
if (!$this->attributes['image']) {
$image = array_get($this->attributes, 'image');
if (!$image) {
return false;
}
if (!file_exists(public_path("public/img/artists/{$this->attributes['image']}"))) {
if (!file_exists(public_path("public/img/artists/$image"))) {
return false;
}