mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2025-12-14 12:06:46 +00:00
✨ Add null-safe operator (?->) to handle nullable user instances in Blade templates
This commit is contained in:
@@ -68,8 +68,8 @@
|
|||||||
</span>
|
</span>
|
||||||
|
|
||||||
<div class="grid flex-1 text-start text-sm leading-tight">
|
<div class="grid flex-1 text-start text-sm leading-tight">
|
||||||
<span class="truncate font-semibold">{{ auth()->user()->name }}</span>
|
<span class="truncate font-semibold">{{ auth()->user()?->name }}</span>
|
||||||
<span class="truncate text-xs">{{ auth()->user()->email }}</span>
|
<span class="truncate text-xs">{{ auth()->user()?->email }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -104,13 +104,13 @@
|
|||||||
<flux:avatar :src="auth()->user()->profile_photo_url" size="sm" class="shrink-0" />
|
<flux:avatar :src="auth()->user()->profile_photo_url" size="sm" class="shrink-0" />
|
||||||
|
|
||||||
<div class="grid flex-1 text-start text-sm leading-tight">
|
<div class="grid flex-1 text-start text-sm leading-tight">
|
||||||
<span class="truncate font-semibold">{{ auth()->user()->name }}</span>
|
<span class="truncate font-semibold">{{ auth()->user()?->name }}</span>
|
||||||
<span class="truncate text-xs">
|
<span class="truncate text-xs">
|
||||||
@if(strlen(auth()->user()->name) > 12)
|
@if(strlen(auth()->user()?->name) > 12)
|
||||||
{{ Str::substr(auth()->user()->name, 0, 4) }}
|
{{ Str::substr(auth()->user()?->name, 0, 4) }}
|
||||||
...{{ Str::substr(auth()->user()->name, -4) }}
|
...{{ Str::substr(auth()->user()?->name, -4) }}
|
||||||
@else
|
@else
|
||||||
{{ auth()->user()->name }}
|
{{ auth()->user()?->name }}
|
||||||
@endif
|
@endif
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -165,13 +165,13 @@
|
|||||||
<flux:avatar :src="auth()->user()->profile_photo_url" size="sm" class="shrink-0" />
|
<flux:avatar :src="auth()->user()->profile_photo_url" size="sm" class="shrink-0" />
|
||||||
|
|
||||||
<div class="grid flex-1 text-start text-sm leading-tight">
|
<div class="grid flex-1 text-start text-sm leading-tight">
|
||||||
<span class="truncate font-semibold">{{ auth()->user()->name }}</span>
|
<span class="truncate font-semibold">{{ auth()->user()?->name }}</span>
|
||||||
<span class="truncate text-xs">
|
<span class="truncate text-xs">
|
||||||
@if(strlen(auth()->user()->name) > 12)
|
@if(strlen(auth()->user()?->name) > 12)
|
||||||
{{ Str::substr(auth()->user()->name, 0, 4) }}
|
{{ Str::substr(auth()->user()?->name, 0, 4) }}
|
||||||
...{{ Str::substr(auth()->user()->name, -4) }}
|
...{{ Str::substr(auth()->user()?->name, -4) }}
|
||||||
@else
|
@else
|
||||||
{{ auth()->user()->name }}
|
{{ auth()->user()?->name }}
|
||||||
@endif
|
@endif
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ new class extends Component {
|
|||||||
<div class="mt-16">
|
<div class="mt-16">
|
||||||
<div class="flex items-center space-x-4 mb-6">
|
<div class="flex items-center space-x-4 mb-6">
|
||||||
<flux:heading size="xl">{{ __('Kommende Veranstaltungen') }}</flux:heading>
|
<flux:heading size="xl">{{ __('Kommende Veranstaltungen') }}</flux:heading>
|
||||||
@if(auth()->user()->meetups()->find($meetup->id)?->exists)
|
@if(auth()->user() && auth()->user()->meetups()->find($meetup->id)?->exists)
|
||||||
<flux:button :href="route_with_country('meetups.events.create', ['meetup' => $meetup])" variant="primary" icon="calendar">
|
<flux:button :href="route_with_country('meetups.events.create', ['meetup' => $meetup])" variant="primary" icon="calendar">
|
||||||
{{ __('Neues Event erstellen') }}
|
{{ __('Neues Event erstellen') }}
|
||||||
</flux:button>
|
</flux:button>
|
||||||
@@ -259,7 +259,7 @@ new class extends Component {
|
|||||||
@else
|
@else
|
||||||
<div class="mt-16">
|
<div class="mt-16">
|
||||||
<div class="flex items-center space-x-4 mb-6">
|
<div class="flex items-center space-x-4 mb-6">
|
||||||
@if(auth()->user()->meetups()->find($meetup->id)?->exists)
|
@if(auth()->user() && auth()->user()->meetups()->find($meetup->id)?->exists)
|
||||||
<flux:button :href="route_with_country('meetups.events.create', ['meetup' => $meetup])" variant="primary" icon="calendar">
|
<flux:button :href="route_with_country('meetups.events.create', ['meetup' => $meetup])" variant="primary" icon="calendar">
|
||||||
{{ __('Neues Event erstellen') }}
|
{{ __('Neues Event erstellen') }}
|
||||||
</flux:button>
|
</flux:button>
|
||||||
|
|||||||
Reference in New Issue
Block a user