new header

This commit is contained in:
HolgerHatGarKeineNode
2023-02-25 23:56:07 +01:00
parent 86e1ed6007
commit f0311f8230
17 changed files with 1596 additions and 296 deletions

View File

@@ -2,8 +2,13 @@
namespace App\Http\Livewire\Frontend;
use App\Models\BitcoinEvent;
use App\Models\City;
use App\Models\Country;
use App\Models\CourseEvent;
use App\Models\LibraryItem;
use App\Models\MeetupEvent;
use App\Models\OrangePill;
use Illuminate\Support\Facades\Cookie;
use Illuminate\Support\Facades\Route;
use Livewire\Component;
@@ -33,7 +38,7 @@ class Header extends Component
public function mount()
{
$this->l = Cookie::get('lang') ?: config('app.locale');
if (! $this->country) {
if (!$this->country) {
$this->country = Country::query()
->where('code', $this->c)
->first();
@@ -59,20 +64,74 @@ class Header extends Component
Cookie::queue('lang', $this->l, 60 * 24 * 365);
return view('livewire.frontend.header', [
'cities' => City::query()
->select(['latitude', 'longitude'])
->get(),
'countries' => Country::query()
->select('id', 'name', 'code')
->orderBy('name')
->get()
->map(function (Country $country) {
$country->name = config('countries.emoji_flags')[str($country->code)
->upper()
->toString()].' '.$country->name;
'news' => LibraryItem::query()
->with([
'createdBy.roles',
'lecturer',
'tags',
])
->where('type', 'markdown_article')
->where('news', true)
->orderByDesc('created_at')
->take(2)
->get(),
'meetups' => MeetupEvent::query()
->with([
'meetup.users',
'meetup.city.country',
])
->where('start', '>', now())
->orderBy('start')
->take(2)
->get(),
'courseEvents' => CourseEvent::query()
->with([
'venue.city.country',
'course.lecturer',
])
->where('from', '>', now())
->orderBy('from')
->take(2)
->get(),
'libraryItems' => LibraryItem::query()
->with([
'lecturer',
])
->where('type', '<>', 'markdown_article')
->orderBy('created_at')
->take(2)
->get(),
'bitcoinEvents' => BitcoinEvent::query()
->with([
'venue',
])
->where('from', '>', now())
->orderBy('from')
->take(2)
->get(),
'orangePills' => OrangePill::query()
->with([
'user',
'bookCase',
])
->where('date', '>', now())
->orderBy('date')
->take(2)
->get(),
'cities' => City::query()
->select(['latitude', 'longitude'])
->get(),
'countries' => Country::query()
->select('id', 'name', 'code')
->orderBy('name')
->get()
->map(function (Country $country) {
$country->name = config('countries.emoji_flags')[str($country->code)
->upper()
->toString()].' '.$country->name;
return $country;
}),
return $country;
}),
]);
}
}