From 9c8402644b6d2a512968c9de8205aa2e72e86640 Mon Sep 17 00:00:00 2001 From: Alex Ramirez Date: Sun, 12 Nov 2023 23:04:13 -0800 Subject: [PATCH] More consice PHP --- app/Models/Favourite.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/Models/Favourite.php b/app/Models/Favourite.php index 019e05df..2f135c87 100644 --- a/app/Models/Favourite.php +++ b/app/Models/Favourite.php @@ -105,10 +105,7 @@ class Favourite extends Model public function getTypeAttribute() { // As of PHP 7.2, get_class is picky about null args - if ($resource = $this->resource) { - return get_class($resource); - } else { - return null; - } + $resource = $this->resource; + return $resource ? get_class($resource) : null; } }