Save workspace changes
This commit is contained in:
74
app/Models/WorldSubmission.php
Normal file
74
app/Models/WorldSubmission.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class WorldSubmission extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public const STATUS_PENDING = 'pending';
|
||||
public const STATUS_LIVE = 'live';
|
||||
public const STATUS_REMOVED = 'removed';
|
||||
public const STATUS_BLOCKED = 'blocked';
|
||||
|
||||
protected $fillable = [
|
||||
'world_id',
|
||||
'artwork_id',
|
||||
'submitted_by_user_id',
|
||||
'status',
|
||||
'is_featured',
|
||||
'mode_snapshot',
|
||||
'note',
|
||||
'reviewer_note',
|
||||
'moderation_reason',
|
||||
'reviewed_by_user_id',
|
||||
'reviewed_at',
|
||||
'removed_at',
|
||||
'blocked_at',
|
||||
'featured_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'is_featured' => 'boolean',
|
||||
'reviewed_at' => 'datetime',
|
||||
'removed_at' => 'datetime',
|
||||
'blocked_at' => 'datetime',
|
||||
'featured_at' => 'datetime',
|
||||
];
|
||||
|
||||
public function canBeReadded(): bool
|
||||
{
|
||||
return (string) $this->status === self::STATUS_REMOVED;
|
||||
}
|
||||
|
||||
public function isBlockingResubmission(): bool
|
||||
{
|
||||
return (string) $this->status === self::STATUS_BLOCKED;
|
||||
}
|
||||
|
||||
public function world(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(World::class);
|
||||
}
|
||||
|
||||
public function artwork(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Artwork::class);
|
||||
}
|
||||
|
||||
public function submittedBy(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'submitted_by_user_id');
|
||||
}
|
||||
|
||||
public function reviewer(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'reviewed_by_user_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user