| 
									
										
										
										
											2021-06-26 23:23:15 +08:00
										 |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-18 00:56:55 +08:00
										 |  |  | namespace BookStack\Permissions\Models; | 
					
						
							| 
									
										
										
										
											2018-09-25 19:30:50 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-18 00:56:55 +08:00
										 |  |  | use BookStack\App\Model; | 
					
						
							| 
									
										
										
										
											2020-11-22 08:17:45 +08:00
										 |  |  | use BookStack\Entities\Models\Entity; | 
					
						
							| 
									
										
										
										
											2023-05-18 00:56:55 +08:00
										 |  |  | use BookStack\Users\Models\Role; | 
					
						
							| 
									
										
										
										
											2020-08-04 20:02:31 +08:00
										 |  |  | use Illuminate\Database\Eloquent\Relations\BelongsTo; | 
					
						
							|  |  |  | use Illuminate\Database\Eloquent\Relations\MorphOne; | 
					
						
							| 
									
										
										
										
											2016-05-02 04:20:50 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | class JointPermission extends Model | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2020-08-04 20:02:31 +08:00
										 |  |  |     protected $primaryKey = null; | 
					
						
							| 
									
										
										
										
											2016-05-02 04:20:50 +08:00
										 |  |  |     public $timestamps = false; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Get the role that this points to. | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2020-08-04 20:02:31 +08:00
										 |  |  |     public function role(): BelongsTo | 
					
						
							| 
									
										
										
										
											2016-05-02 04:20:50 +08:00
										 |  |  |     { | 
					
						
							|  |  |  |         return $this->belongsTo(Role::class); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Get the entity this points to. | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2020-08-04 20:02:31 +08:00
										 |  |  |     public function entity(): MorphOne | 
					
						
							| 
									
										
										
										
											2016-05-02 04:20:50 +08:00
										 |  |  |     { | 
					
						
							|  |  |  |         return $this->morphOne(Entity::class, 'entity'); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |