From 52bd1012a565aa11c673cfe0912ac63f7559fbac Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Wed, 21 Jul 2021 18:15:44 +0200 Subject: [PATCH] app/Models/Character.php: Add isMain() --- app/Models/Character.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/Models/Character.php b/app/Models/Character.php index 979f24a..b9d45ca 100644 --- a/app/Models/Character.php +++ b/app/Models/Character.php @@ -67,6 +67,14 @@ class Character extends Model return $this->belongsTo(User::class); } + /** + * Check if this character is the user's main character + */ + public function isMain() + { + return $this->user->character_id == $this->id; + } + /** * Retrieve the character's professions. */