2020-12-30 18:25:35 +00:00
|
|
|
<?php namespace BookStack\Traits;
|
2015-12-09 19:50:17 +00:00
|
|
|
|
2018-09-25 12:30:50 +01:00
|
|
|
use BookStack\Auth\User;
|
2020-12-30 18:25:35 +00:00
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
2018-09-25 12:30:50 +01:00
|
|
|
|
2020-05-01 23:24:11 +01:00
|
|
|
/**
|
|
|
|
* @property int created_by
|
|
|
|
* @property int updated_by
|
|
|
|
*/
|
2020-12-30 18:25:35 +00:00
|
|
|
trait HasCreatorAndUpdater
|
2015-12-09 19:50:17 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Relation for the user that created this entity.
|
|
|
|
*/
|
2020-12-30 18:25:35 +00:00
|
|
|
public function createdBy(): BelongsTo
|
2015-12-09 19:50:17 +00:00
|
|
|
{
|
2016-05-01 21:20:50 +01:00
|
|
|
return $this->belongsTo(User::class, 'created_by');
|
2015-12-09 19:50:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Relation for the user that updated this entity.
|
|
|
|
*/
|
2020-12-30 18:25:35 +00:00
|
|
|
public function updatedBy(): BelongsTo
|
2015-12-09 19:50:17 +00:00
|
|
|
{
|
2016-05-01 21:20:50 +01:00
|
|
|
return $this->belongsTo(User::class, 'updated_by');
|
2015-12-09 19:50:17 +00:00
|
|
|
}
|
2018-01-28 16:58:52 +00:00
|
|
|
}
|