From 5c6f7da07df8f9dcb98e132ee8724ffecdb6b5fb Mon Sep 17 00:00:00 2001 From: "Ramon J. A. Smit" Date: Fri, 13 Apr 2018 15:10:54 +0200 Subject: [PATCH] Update Permission.php --- src/Models/Permission.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Models/Permission.php b/src/Models/Permission.php index 4b408bb..0b33ee4 100644 --- a/src/Models/Permission.php +++ b/src/Models/Permission.php @@ -4,11 +4,10 @@ use Illuminate\Database\Eloquent\Model; -class Permission extends Model +class Role extends Model { protected $fillable = [ - 'name', - 'description' + 'name' ]; protected $hidden = [ @@ -17,4 +16,14 @@ class Permission extends Model 'updated_at', 'pivot' ]; + + /** + * Get permissions that are linked to this role + * + * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany + */ + public function permissions() + { + return $this->belongsToMany(Permission::class); + } }