datatable.directory codebase https://datatable.directory/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
datatable.directory/app/Models/DataTable.php

51 lines
1.0 KiB

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class DataTable extends Model
{
/** Owning user */
public function owner()
{
return $this->belongsTo(User::class, 'owner_id');
}
/** Fork precursor */
public function precursor()
{
return $this->belongsTo(DataTable::class, 'precursor_id');
}
/** Fork descendants */
public function descendants()
{
return $this->hasMany(DataTable::class, 'precursor_id');
}
/** Changesets */
public function changesets()
{
return $this->hasMany(Changeset::class);
}
/** Data rows */
public function dataRows()
{
return $this->hasMany(DataRow::class);
}
/** Changesets already merged */
public function appliedChangesets()
{
return $this->hasMany(Changeset::class)->where('applied', true);
}
/** Changesets already merged */
public function pendingChangesets()
{
return $this->hasMany(Changeset::class)->where('applied', false);
}
}