Fix Event & EventType resource issues and apply formatting
- Fix EventType deletion error handling (constraint violations) - Fix Event update error (package_id column missing) - Fix Event Type dropdown options (JSON display issue) - Fix EventPackagesRelationManager query error - Add missing translations for deletion errors - Apply Pint formatting
This commit is contained in:
@@ -75,11 +75,11 @@ class AbandonedCheckout extends Model
|
||||
public function scopeReadyForReminder($query, string $stage, int $hours)
|
||||
{
|
||||
return $query->where('reminder_stage', '!=', $stage)
|
||||
->where('reminder_stage', '!=', 'converted')
|
||||
->where('abandoned_at', '<=', now()->subHours($hours))
|
||||
->where(function ($q) {
|
||||
$q->whereNull('reminded_at')
|
||||
->orWhere('reminded_at', '<=', now()->subHours(24));
|
||||
});
|
||||
->where('reminder_stage', '!=', 'converted')
|
||||
->where('abandoned_at', '<=', now()->subHours($hours))
|
||||
->where(function ($q) {
|
||||
$q->whereNull('reminded_at')
|
||||
->orWhere('reminded_at', '<=', now()->subHours(24));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,4 +19,4 @@ class BlogAuthor extends Model
|
||||
'github_handle',
|
||||
'twitter_handle',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class BlogCategory extends Model
|
||||
{
|
||||
@@ -42,4 +41,4 @@ class BlogCategory extends Model
|
||||
{
|
||||
return $query->where('is_visible', false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,19 +8,18 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Spatie\Translatable\HasTranslations;
|
||||
use League\CommonMark\Environment\Environment;
|
||||
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
|
||||
use League\CommonMark\Extension\Table\TableExtension;
|
||||
use League\CommonMark\Extension\Autolink\AutolinkExtension;
|
||||
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
|
||||
use League\CommonMark\Extension\Strikethrough\StrikethroughExtension;
|
||||
use League\CommonMark\Extension\Table\TableExtension;
|
||||
use League\CommonMark\Extension\TaskList\TaskListExtension;
|
||||
use League\CommonMark\MarkdownConverter;
|
||||
use Spatie\Translatable\HasTranslations;
|
||||
|
||||
class BlogPost extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes, HasTranslations;
|
||||
use HasFactory, HasTranslations, SoftDeletes;
|
||||
|
||||
protected $table = 'blog_posts';
|
||||
|
||||
@@ -78,14 +77,15 @@ class BlogPost extends Model
|
||||
return Attribute::get(function () {
|
||||
$markdown = $this->getTranslation('content', app()->getLocale());
|
||||
|
||||
$environment = new Environment();
|
||||
$environment->addExtension(new CommonMarkCoreExtension());
|
||||
$environment->addExtension(new TableExtension());
|
||||
$environment->addExtension(new AutolinkExtension());
|
||||
$environment->addExtension(new StrikethroughExtension());
|
||||
$environment->addExtension(new TaskListExtension());
|
||||
$environment = new Environment;
|
||||
$environment->addExtension(new CommonMarkCoreExtension);
|
||||
$environment->addExtension(new TableExtension);
|
||||
$environment->addExtension(new AutolinkExtension);
|
||||
$environment->addExtension(new StrikethroughExtension);
|
||||
$environment->addExtension(new TaskListExtension);
|
||||
|
||||
$converter = new MarkdownConverter($environment);
|
||||
|
||||
return (string) $converter->convert($markdown);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3,14 +3,13 @@
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Spatie\Tags\Tag;
|
||||
use Spatie\Translatable\HasTranslations;
|
||||
|
||||
class BlogTag extends Tag
|
||||
{
|
||||
use HasFactory, SoftDeletes, HasTranslations;
|
||||
use HasFactory, HasTranslations, SoftDeletes;
|
||||
|
||||
protected $translatable = [
|
||||
'name',
|
||||
@@ -20,4 +19,4 @@ class BlogTag extends Tag
|
||||
'slug',
|
||||
'translations',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,9 @@ class Emotion extends Model
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'emotions';
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
protected $casts = [
|
||||
'name' => 'array',
|
||||
'description' => 'array',
|
||||
@@ -34,4 +36,3 @@ class Emotion extends Model
|
||||
return $this->hasMany(Task::class);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,4 +47,3 @@ class EventJoinTokenEvent extends Model
|
||||
return $this->belongsTo(Tenant::class);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,4 +51,3 @@ class EventMediaAsset extends Model
|
||||
return $this->belongsTo(Photo::class);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,9 @@ class EventPurchase extends Model
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'event_purchases';
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
protected $casts = [
|
||||
'purchased_at' => 'datetime',
|
||||
'amount' => 'decimal:2',
|
||||
@@ -21,4 +23,4 @@ class EventPurchase extends Model
|
||||
{
|
||||
return $this->belongsTo(Tenant::class);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,4 +36,3 @@ class EventStorageAssignment extends Model
|
||||
return $this->belongsTo(MediaStorageTarget::class, 'media_storage_target_id');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,9 @@ class EventType extends Model
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'event_types';
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
protected $casts = [
|
||||
'name' => 'array',
|
||||
'settings' => 'array',
|
||||
@@ -28,4 +30,3 @@ class EventType extends Model
|
||||
return $this->hasMany(Event::class);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,9 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class LegalPage extends Model
|
||||
{
|
||||
protected $table = 'legal_pages';
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
protected $casts = [
|
||||
'title' => 'array',
|
||||
'body_markdown' => 'array',
|
||||
@@ -15,4 +17,3 @@ class LegalPage extends Model
|
||||
'effective_from' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -63,4 +63,3 @@ class MediaStorageTarget extends Model
|
||||
return array_merge($base, $config);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,11 +8,13 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
class PhotoLike extends Model
|
||||
{
|
||||
protected $table = 'photo_likes';
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
public function photo(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Photo::class);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,11 @@ class PurchaseHistory extends Model
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'purchase_history';
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
public $incrementing = false;
|
||||
|
||||
protected $keyType = 'string';
|
||||
|
||||
protected $guarded = [];
|
||||
@@ -28,4 +31,3 @@ class PurchaseHistory extends Model
|
||||
return $this->belongsTo(Tenant::class);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user