added a help system, replaced the words "tenant" and "Pwa" with better alternatives. corrected and implemented cron jobs. prepared going live on a coolify-powered system.
This commit is contained in:
@@ -6,17 +6,29 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use App\Models\EventMediaAsset;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Znck\Eloquent\Relations\BelongsToThrough as BelongsToThroughRelation;
|
||||
use Znck\Eloquent\Traits\BelongsToThrough;
|
||||
|
||||
class Photo extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use BelongsToThrough;
|
||||
use HasFactory;
|
||||
|
||||
public const SOURCE_GUEST_PWA = 'guest_pwa';
|
||||
|
||||
public const SOURCE_TENANT_ADMIN = 'tenant_admin';
|
||||
|
||||
public const SOURCE_PHOTOBOOTH = 'photobooth';
|
||||
|
||||
public const SOURCE_UNKNOWN = 'unknown';
|
||||
|
||||
protected static ?array $columnCache = null;
|
||||
|
||||
protected $table = 'photos';
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
protected $casts = [
|
||||
'is_featured' => 'boolean',
|
||||
'metadata' => 'array',
|
||||
@@ -26,6 +38,7 @@ class Photo extends Model
|
||||
|
||||
protected $attributes = [
|
||||
'security_scan_status' => 'pending',
|
||||
'ingest_source' => self::SOURCE_GUEST_PWA,
|
||||
];
|
||||
|
||||
public function mediaAsset(): BelongsTo
|
||||
@@ -63,6 +76,20 @@ class Photo extends Model
|
||||
return $this->hasMany(PhotoLike::class);
|
||||
}
|
||||
|
||||
public static function supportsFilenameColumn(): bool
|
||||
{
|
||||
return static::hasColumn('filename');
|
||||
}
|
||||
|
||||
public static function hasColumn(string $column): bool
|
||||
{
|
||||
if (static::$columnCache === null) {
|
||||
static::$columnCache = Schema::getColumnListing((new self)->getTable());
|
||||
}
|
||||
|
||||
return in_array($column, static::$columnCache, true);
|
||||
}
|
||||
|
||||
public function tenant(): BelongsToThroughRelation
|
||||
{
|
||||
return $this->belongsToThrough(
|
||||
|
||||
Reference in New Issue
Block a user