'int', 'model_id' => 'int', 'permission_id' => 'int', 'effect' => 'int', // 1=ALLOW, -1=DENY 'effective_from' => 'datetime', 'effective_to' => 'datetime', ]; /** * 예외가 걸린 주체(User, Department 등) * model_type, model_id를 사용하는 morphTo */ public function model() { // morphTo(relationshipName, type, id) return $this->morphTo('model', 'model_type', 'model_id'); } /** 연결된 Spatie Permission */ public function permission() { return $this->belongsTo(SpatiePermission::class, 'permission_id'); } }