]> BookStack Code Mirror - bookstack/blob - app/References/Reference.php
Added method for using enity ownership in relation queries
[bookstack] / app / References / Reference.php
1 <?php
2
3 namespace BookStack\References;
4
5 use Illuminate\Database\Eloquent\Model;
6 use Illuminate\Database\Eloquent\Relations\MorphTo;
7
8 /**
9  * @property int    $from_id
10  * @property string $from_type
11  * @property int    $to_id
12  * @property string $to_type
13  */
14 class Reference extends Model
15 {
16     public $timestamps = false;
17
18     public function from(): MorphTo
19     {
20         return $this->morphTo('from');
21     }
22
23     public function to(): MorphTo
24     {
25         return $this->morphTo('to');
26     }
27 }