mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2025-12-13 23:56:47 +00:00
✨ Add null-safe operator (?->) to handle nullable user instances in Blade templates
This commit is contained in:
@@ -68,8 +68,8 @@
|
||||
</span>
|
||||
|
||||
<div class="grid flex-1 text-start text-sm leading-tight">
|
||||
<span class="truncate font-semibold">{{ auth()->user()->name }}</span>
|
||||
<span class="truncate text-xs">{{ auth()->user()->email }}</span>
|
||||
<span class="truncate font-semibold">{{ auth()->user()?->name }}</span>
|
||||
<span class="truncate text-xs">{{ auth()->user()?->email }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -104,13 +104,13 @@
|
||||
<flux:avatar :src="auth()->user()->profile_photo_url" size="sm" class="shrink-0" />
|
||||
|
||||
<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">
|
||||
@if(strlen(auth()->user()->name) > 12)
|
||||
{{ Str::substr(auth()->user()->name, 0, 4) }}
|
||||
...{{ Str::substr(auth()->user()->name, -4) }}
|
||||
@if(strlen(auth()->user()?->name) > 12)
|
||||
{{ Str::substr(auth()->user()?->name, 0, 4) }}
|
||||
...{{ Str::substr(auth()->user()?->name, -4) }}
|
||||
@else
|
||||
{{ auth()->user()->name }}
|
||||
{{ auth()->user()?->name }}
|
||||
@endif
|
||||
</span>
|
||||
</div>
|
||||
@@ -165,13 +165,13 @@
|
||||
<flux:avatar :src="auth()->user()->profile_photo_url" size="sm" class="shrink-0" />
|
||||
|
||||
<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">
|
||||
@if(strlen(auth()->user()->name) > 12)
|
||||
{{ Str::substr(auth()->user()->name, 0, 4) }}
|
||||
...{{ Str::substr(auth()->user()->name, -4) }}
|
||||
@if(strlen(auth()->user()?->name) > 12)
|
||||
{{ Str::substr(auth()->user()?->name, 0, 4) }}
|
||||
...{{ Str::substr(auth()->user()?->name, -4) }}
|
||||
@else
|
||||
{{ auth()->user()->name }}
|
||||
{{ auth()->user()?->name }}
|
||||
@endif
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -193,7 +193,7 @@ new class extends Component {
|
||||
<div class="mt-16">
|
||||
<div class="flex items-center space-x-4 mb-6">
|
||||
<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">
|
||||
{{ __('Neues Event erstellen') }}
|
||||
</flux:button>
|
||||
@@ -259,7 +259,7 @@ new class extends Component {
|
||||
@else
|
||||
<div class="mt-16">
|
||||
<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">
|
||||
{{ __('Neues Event erstellen') }}
|
||||
</flux:button>
|
||||
|
||||
Reference in New Issue
Block a user