updated models
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Riesjart\Relaquent\Model\Concerns\HasRelaquentRelationships;
|
||||
|
||||
/**
|
||||
* Table revision (a set of rows)
|
||||
*/
|
||||
class Revision extends Model
|
||||
{
|
||||
use HasRelaquentRelationships;
|
||||
|
||||
/** Included rows */
|
||||
public function rows()
|
||||
{
|
||||
return $this->belongsToMany(Row::class, 'revision_row_pivot');
|
||||
}
|
||||
|
||||
/** Proposal that lead to this revision */
|
||||
public function appliedProposal()
|
||||
{
|
||||
return $this->hasOneThrough(Proposal::class, 'revision_proposal_pivot');
|
||||
}
|
||||
|
||||
/** Proposals that depend on this revision */
|
||||
public function dependentProposals()
|
||||
{
|
||||
return $this->hasMany(Proposal::class);
|
||||
}
|
||||
|
||||
/** Revision this orignates from */
|
||||
public function parentRevision()
|
||||
{
|
||||
return $this->belongsTo(Revision::class, 'ancestor_id');
|
||||
}
|
||||
|
||||
/** Tables referencing this revision */
|
||||
public function tables()
|
||||
{
|
||||
return $this->belongsToMany(Table::class, 'table_revision_pivot');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user