2022-08-17 21:39:53 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace BookStack\References;
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
|
|
|
|
|
|
|
/**
|
2022-08-30 00:46:41 +08:00
|
|
|
* @property int $from_id
|
2022-08-17 21:39:53 +08:00
|
|
|
* @property string $from_type
|
2022-08-30 00:46:41 +08:00
|
|
|
* @property int $to_id
|
2022-08-17 21:39:53 +08:00
|
|
|
* @property string $to_type
|
|
|
|
*/
|
|
|
|
class Reference extends Model
|
|
|
|
{
|
2022-08-18 00:37:27 +08:00
|
|
|
public $timestamps = false;
|
|
|
|
|
2022-08-17 21:39:53 +08:00
|
|
|
public function from(): MorphTo
|
|
|
|
{
|
|
|
|
return $this->morphTo('from');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function to(): MorphTo
|
|
|
|
{
|
|
|
|
return $this->morphTo('to');
|
|
|
|
}
|
|
|
|
}
|