|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
use App\Models\Concerns\Reportable;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Change proposal
|
|
|
|
*
|
|
|
|
* @property int $id
|
|
|
|
* @property \Carbon\Carbon $created_at
|
|
|
|
* @property \Carbon\Carbon $updated_at
|
|
|
|
* @property int $table_id
|
|
|
|
* @property int $revision_id
|
|
|
|
* @property int $author_id
|
|
|
|
* @property string $note
|
|
|
|
* @property object $changes - JSONB
|
|
|
|
* @property-read User $author
|
|
|
|
* @property-read Table $table
|
|
|
|
* @property-read Revision $revision
|
|
|
|
*/
|
|
|
|
class Proposal extends Model
|
|
|
|
{
|
|
|
|
use Reportable;
|
|
|
|
protected $guarded = [];
|
|
|
|
|
|
|
|
protected $touches = ['author', 'table'];
|
|
|
|
|
|
|
|
/** Authoring user */
|
|
|
|
public function author()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(User::class, 'author_id');
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Target revision */
|
|
|
|
public function revision()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(Revision::class);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Target table (that this was submitted to) */
|
|
|
|
public function table()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(Table::class);
|
|
|
|
}
|
|
|
|
}
|