events werden nun erfolgreich gespeichert, branding wird nun erfolgreich gespeichert, emotionen können nun angelegt werden. Task Ansicht im Event admin verbessert, Buttons in FAB umgewandelt und vereinheitlicht. Teilen-Link Guest PWA schicker gemacht, SynGoogleFonts ausgebaut (mit Einzel-Family-Download).
This commit is contained in:
@@ -13,6 +13,7 @@ use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class EmotionController extends Controller
|
||||
{
|
||||
@@ -21,8 +22,15 @@ class EmotionController extends Controller
|
||||
$tenantId = $this->currentTenant($request)->id;
|
||||
|
||||
$query = Emotion::query()
|
||||
->whereNull('tenant_id')
|
||||
->orWhere('tenant_id', $tenantId)
|
||||
->when(true, function ($builder) use ($tenantId) {
|
||||
// Prefer tenant-specific and global emotions if the column exists
|
||||
if (Schema::hasColumn('emotions', 'tenant_id')) {
|
||||
$builder->where(function ($inner) use ($tenantId) {
|
||||
$inner->whereNull('tenant_id')
|
||||
->orWhere('tenant_id', $tenantId);
|
||||
});
|
||||
}
|
||||
})
|
||||
->with('eventTypes');
|
||||
|
||||
if ($request->boolean('only_tenant')) {
|
||||
@@ -35,7 +43,18 @@ class EmotionController extends Controller
|
||||
|
||||
$query->orderByRaw('tenant_id is null desc')->orderBy('sort_order')->orderBy('id');
|
||||
|
||||
$emotions = $query->paginate($request->integer('per_page', 25));
|
||||
$emotions = $query->paginate($request->integer('per_page', 50));
|
||||
|
||||
if ($emotions->isEmpty() && ! $request->boolean('only_tenant')) {
|
||||
// Fallback: return any emotions regardless of tenant to avoid empty selectors
|
||||
$fallback = Emotion::query()
|
||||
->with('eventTypes')
|
||||
->orderBy('sort_order')
|
||||
->orderBy('id')
|
||||
->paginate($request->integer('per_page', 50));
|
||||
|
||||
return EmotionResource::collection($fallback);
|
||||
}
|
||||
|
||||
return EmotionResource::collection($emotions);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user