EntityUser.php
1 <?php 2 3 namespace App\Models; 4 5 use Illuminate\Database\Eloquent\Relations\BelongsTo; 6 use Illuminate\Database\Eloquent\Relations\MorphPivot; 7 use Spatie\Permission\Models\Role; 8 9 class EntityUser extends MorphPivot 10 { 11 protected $with = ['role', 'entity']; 12 13 public function role(): BelongsTo 14 { 15 return $this->belongsTo(Role::class); 16 } 17 18 public function entity(): BelongsTo 19 { 20 return $this->belongsTo(Entity::class); 21 } 22 }