More consice PHP

This commit is contained in:
Alex Ramirez 2023-11-12 23:04:13 -08:00
parent 8f71b408ef
commit 9c8402644b

View file

@ -105,10 +105,7 @@ class Favourite extends Model
public function getTypeAttribute() public function getTypeAttribute()
{ {
// As of PHP 7.2, get_class is picky about null args // As of PHP 7.2, get_class is picky about null args
if ($resource = $this->resource) { $resource = $this->resource;
return get_class($resource); return $resource ? get_class($resource) : null;
} else {
return null;
}
} }
} }