]> BookStack Code Mirror - bookstack/blob - app/Entities/Models/SlugHistory.php
Merge pull request #5913 from BookStackApp/slug_history
[bookstack] / app / Entities / Models / SlugHistory.php
1 <?php
2
3 namespace BookStack\Entities\Models;
4
5 use BookStack\App\Model;
6 use BookStack\Permissions\Models\JointPermission;
7 use Illuminate\Database\Eloquent\Factories\HasFactory;
8 use Illuminate\Database\Eloquent\Relations\HasMany;
9
10 /**
11  * @property int $id
12  * @property int $sluggable_id
13  * @property string $sluggable_type
14  * @property string $slug
15  * @property ?string $parent_slug
16  */
17 class SlugHistory extends Model
18 {
19     use HasFactory;
20
21     protected $table = 'slug_history';
22
23     public function jointPermissions(): HasMany
24     {
25         return $this->hasMany(JointPermission::class, 'entity_id', 'sluggable_id')
26             ->whereColumn('joint_permissions.entity_type', '=', 'slug_history.sluggable_type');
27     }
28 }