diff --git a/app/Models/ContentReport.php b/app/Models/ContentReport.php index d9fce75..f3ad46c 100644 --- a/app/Models/ContentReport.php +++ b/app/Models/ContentReport.php @@ -6,6 +6,16 @@ use Illuminate\Database\Eloquent\Model; /** * Report (something objectionable spotted by a user) + * + * @property int $id + * @property \Carbon\Carbon $created_at + * @property \Carbon\Carbon $updated_at + * @property string $object_type + * @property int $object_id + * @property int $author_id + * @property string $message + * @property User $author + * @property mixed $object - morph */ class ContentReport extends Model { diff --git a/app/Models/Notification.php b/app/Models/Notification.php deleted file mode 100644 index 43efdfc..0000000 --- a/app/Models/Notification.php +++ /dev/null @@ -1,51 +0,0 @@ -belongsTo(User::class, 'user_id'); - } - - /** User who triggered this notification */ - public function actor() - { - return $this->belongsTo(User::class, 'actor_id'); - } - - /** Notification context (what was affected) */ - public function context() - { - return $this->morphTo(); - } - - /** - * Unseen notifications - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @return \Illuminate\Database\Eloquent\Builder - */ - public function scopeUnseen($query) - { - return $query->where('seen', false); - } - - /** - * Seen notifications - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @return \Illuminate\Database\Eloquent\Builder - */ - public function scopeSeen($query) - { - return $query->where('seen', true); - } -} diff --git a/app/Models/Proposal.php b/app/Models/Proposal.php index b9e09c3..0efde71 100644 --- a/app/Models/Proposal.php +++ b/app/Models/Proposal.php @@ -2,16 +2,23 @@ namespace App\Models; -use App\Models\Concerns\NotificationContext; use App\Models\Concerns\Reportable; -use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Model; /** * Change proposal * - * @property Row[]|Collection $addedRows - * @property Row[]|Collection $removedRows + * @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 User $author + * @property Table $table + * @property Revision $revision + * @property object $changes - JSONB */ class Proposal extends Model { diff --git a/app/Models/Revision.php b/app/Models/Revision.php index c3290ff..c64fce8 100644 --- a/app/Models/Revision.php +++ b/app/Models/Revision.php @@ -3,10 +3,23 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; +use Illuminate\Support\Collection; use Riesjart\Relaquent\Model\Concerns\HasRelaquentRelationships; /** * Table revision (a set of rows) + * + * @property int $id + * @property \Carbon\Carbon $created_at + * @property \Carbon\Carbon $updated_at + * @property int $refs + * @property int $ancestor_id + * @property string $note + * @property string $index_column + * @property Revision|null $parentRevision + * @property Row[]|Collection $rows + * @property Proposal|null $sourceProposal - proposal that was used to create this revision + * @property Proposal[]|Collection $dependentProposals */ class Revision extends Model { @@ -29,7 +42,7 @@ class Revision extends Model } /** Proposal that lead to this revision */ - public function appliedProposal() + public function sourceProposal() { return $this->hasOneThrough(Proposal::class, 'revision_proposal_pivot'); } diff --git a/app/Models/Row.php b/app/Models/Row.php index 3b5a9b1..b217c72 100644 --- a/app/Models/Row.php +++ b/app/Models/Row.php @@ -6,7 +6,12 @@ use Illuminate\Database\Eloquent\Model; /** * Row in a data table + * + * @property int $id + * @property int $refs + * @property string $data - JSONB */ class Row extends Model { + public $timestamps = false; } diff --git a/app/Models/Table.php b/app/Models/Table.php index aa44cd8..01bcc3f 100644 --- a/app/Models/Table.php +++ b/app/Models/Table.php @@ -2,12 +2,32 @@ namespace App\Models; -use App\Models\Concerns\NotificationContext; use App\Models\Concerns\Reportable; +use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Model; /** - * A data table object (referencing changesets and rows) + * A data table object (referencing revisions) + * + * @property int $id + * @property \Carbon\Carbon $created_at + * @property \Carbon\Carbon $updated_at + * @property int $owner_id + * @property int $ancestor_id + * @property int $revision_id + * @property string $title + * @property string $description + * @property string $license + * @property string $source_link + * @property User $owner + * @property Table $parentTable + * @property Table[]|Collection $forks + * @property Revision[]|Collection $revisions + * @property Revision $activeRevision + * @property Proposal[]|Collection $proposal + * @property TableComment[]|Collection $comments + * @property User[]|Collection $favouritingUsers + * @property User[]|Collection $discussionFollowers */ class Table extends Model { diff --git a/app/Models/TableComment.php b/app/Models/TableComment.php index 19bcfbb..820b912 100644 --- a/app/Models/TableComment.php +++ b/app/Models/TableComment.php @@ -2,12 +2,24 @@ namespace App\Models; -use App\Models\Concerns\NotificationContext; use App\Models\Concerns\Reportable; +use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Model; /** * Comment on a data table + * + * @property int $id + * @property \Carbon\Carbon $created_at + * @property \Carbon\Carbon $updated_at + * @property int $table_id + * @property int $author_id + * @property int $ancestor_id + * @property string $message + * @property User $author + * @property Table $table + * @property TableComment|null $ancestor + * @property TableComment[]|Collection $replies */ class TableComment extends Model { diff --git a/app/Models/User.php b/app/Models/User.php index bab1ae6..b23188a 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -4,7 +4,6 @@ namespace App\Models; use AdamWathan\EloquentOAuth\OAuthIdentity; use App\Models\Concerns\Reportable; -use Carbon\Carbon; use Illuminate\Database\Eloquent\Collection; use Illuminate\Notifications\Notifiable; use Illuminate\Foundation\Auth\User as Authenticatable; @@ -12,8 +11,9 @@ use Illuminate\Foundation\Auth\User as Authenticatable; /** * A user in the application * - * @property Carbon $created_at - * @property Carbon $updated_at + * @property int $id + * @property \Carbon\Carbon $created_at + * @property \Carbon\Carbon $updated_at * @property string $name - unique, for vanity URL * @property string $email - unique, for login and social auth chaining * @property string $password - hashed pw