Working proposal apply code, fixed schema (need reset - artisan migrate:fresh)

This commit is contained in:
2018-08-11 18:42:12 +02:00
parent 8efc31d820
commit f2910f977f
12 changed files with 168 additions and 69 deletions
+5 -4
View File
@@ -13,12 +13,13 @@ use Riesjart\Relaquent\Model\Concerns\HasRelaquentRelationships;
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property int $ancestor_id
* @property int $proposal_id
* @property string $note
* @property object $columns
* @property int $row_count - cached number of rows in the revision
* @property-read Revision|null $parentRevision
* @property-read Row[]|Collection $rows
* @property-read Proposal|null $sourceProposal - proposal that was used to create this revision
* @property-read Proposal|null $proposal - proposal that was used to create this revision
* @property-read Proposal[]|Collection $dependentProposals
*/
class Revision extends BaseModel
@@ -52,15 +53,15 @@ class Revision extends BaseModel
}
/** Proposal that lead to this revision */
public function sourceProposal()
public function proposal()
{
return $this->hasOneThrough(Proposal::class, 'revision_proposal_pivot');
return $this->belongsTo(Proposal::class, 'proposal_id');
}
/** Proposals that depend on this revision */
public function dependentProposals()
{
return $this->hasMany(Proposal::class);
return $this->hasMany(Proposal::class, 'revision_id');
}
/** Revision this orignates from */