reworked the guest pwa, modernized start and gallery page. added share link functionality.

This commit is contained in:
Codex Agent
2025-11-10 22:25:25 +01:00
parent 1e8810ca51
commit 1cec116933
22 changed files with 1208 additions and 476 deletions

View File

@@ -0,0 +1,51 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Support\Str;
class PhotoShareLink extends Model
{
use HasFactory;
protected $fillable = [
'photo_id',
'slug',
'expires_at',
'created_by_device_id',
'created_ip',
'last_accessed_at',
];
protected $casts = [
'expires_at' => 'datetime',
'last_accessed_at' => 'datetime',
];
protected static function booted(): void
{
static::creating(function (PhotoShareLink $link) {
if (! $link->slug) {
$link->slug = static::generateSlug();
}
});
}
public static function generateSlug(): string
{
return Str::lower(Str::random(40));
}
public function photo(): BelongsTo
{
return $this->belongsTo(Photo::class);
}
public function isExpired(): bool
{
return $this->expires_at !== null && $this->expires_at->isPast();
}
}