From 52daa3b68f1a2e1085981bd97ffb57c64cb08350 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Tue, 13 Jul 2021 18:01:49 +0200 Subject: [PATCH] app/Models/User.php: adding getRoleAttribute() --- app/Models/User.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/Models/User.php b/app/Models/User.php index b3dc880..f47c02a 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -46,4 +46,12 @@ class User extends Authenticatable { return $this->hasMany(Character::class); } + + public function getRoleAttribute() + { + if (!$this->attributes['role']) { + return 'user'; + } + return $this->attributes['role']; + } }