- - - {{ $item->name }} - -
-- {{ __('Yes') }}: {{ $item->votes->where('value', 1)->count() }} / {{ __('No') }}: {{ $item->votes->where('value', 0)->count() }} -
-- {{ __('From') }}: {{ $item->user->name }} -
-diff --git a/app/Http/Controllers/Export/MeetupEventAttendeesExportController.php b/app/Http/Controllers/Export/MeetupEventAttendeesExportController.php deleted file mode 100644 index 60516ca5..00000000 --- a/app/Http/Controllers/Export/MeetupEventAttendeesExportController.php +++ /dev/null @@ -1,19 +0,0 @@ -download($meetupEvent->start->toDateString().'_'.$meetupEvent->meetup->slug.'.xlsx'); - } -} diff --git a/app/Http/Livewire/Auth/Auth47Component.php b/app/Http/Livewire/Auth/Auth47Component.php deleted file mode 100644 index e51f4eba..00000000 --- a/app/Http/Livewire/Auth/Auth47Component.php +++ /dev/null @@ -1,28 +0,0 @@ -k1 = bin2hex(str()->random(32)); - $this->url = 'auth47://'.$this->k1.'?c=https://einundzwanzig.eu-1.sharedwithexpose.com/auth/auth47-callback&r=https://einundzwanzig.eu-1.sharedwithexpose.com/auth/auth47-callback'; - $this->qrCode = base64_encode(QrCode::format('png') - ->size(600) - ->errorCorrection('L') - ->generate($this->url)); - } - - public function render() - { - return view('livewire.auth.auth47-component')->layout('layouts.guest'); - } -} diff --git a/app/Http/Livewire/Auth/LNUrlAuth.php b/app/Http/Livewire/Auth/LNUrlAuth.php deleted file mode 100644 index bcc493b4..00000000 --- a/app/Http/Livewire/Auth/LNUrlAuth.php +++ /dev/null @@ -1,73 +0,0 @@ -k1 = bin2hex(str()->random(32)); - if (app()->environment('local')) { - $this->url = 'https://einundzwanzig.eu-1.sharedwithexpose.com/api/lnurl-auth-callback?tag=login&k1='.$this->k1.'&action=login'; - } else { - $this->url = url('/api/lnurl-auth-callback?tag=login&k1='.$this->k1.'&action=login'); - } - $this->lnurl = lnurl\encodeUrl($this->url); - $this->qrCode = base64_encode(QrCode::format('png') - ->size(300) - ->merge('/public/android-chrome-192x192.png', .3) - ->errorCorrection('H') - ->generate($this->lnurl)); - } - - public function checkAuth() - { - $loginKey = LoginKey::query() - ->where('k1', $this->k1) - ->whereDate('created_at', '>=', now()->subMinutes(5)) - ->first(); - // you should also restrict this 👆🏻 by time, and find only the $k1 that were created in the last 5 minutes - - if ($loginKey) { - $user = User::find($loginKey->user_id); - - \App\Models\User::find(1) - ->notify(new ModelCreatedNotification($user, 'users')); - auth()->login($user); - - return to_route('welcome'); - } - - return true; - } - - public function render() - { - return view('livewire.auth.ln-url-auth')->layout('layouts.guest'); - } -} diff --git a/app/Http/Livewire/Auth/Login.php b/app/Http/Livewire/Auth/Login.php deleted file mode 100644 index 55673a3d..00000000 --- a/app/Http/Livewire/Auth/Login.php +++ /dev/null @@ -1,72 +0,0 @@ - 'required|string', - 'userProfile.pubkey' => 'required|string', - - 'userProfile.banner' => 'required|string', - 'userProfile.image' => 'required|string', - - 'userProfile.name' => 'required|string', - 'userProfile.username' => 'required|string', - 'userProfile.website' => 'required|string', - 'userProfile.about' => 'required|string', - 'userProfile.displayName' => 'required|string', - 'userProfile.lud16' => 'required|string', - 'userProfile.nip05' => 'required|string', - ]; - } - - public function login($value) - { - if ($value) { - $firstUser = User::query()->where('nostr', $value)->first(); - if ($firstUser) { - auth()->login($firstUser, true); - - return to_route('welcome'); - } else { - $fakeName = str()->random(10); - // create User - $user = User::create([ - 'is_lecturer' => true, - 'name' => $fakeName, - 'email' => str($fakeName)->slug() . '@portal.einundzwanzig.space', - 'email_verified_at' => now(), - 'lnbits' => [ - 'read_key' => null, - 'url' => null, - 'wallet_id' => null, - ], - 'nostr' => $value, - ]); - $user->ownedTeams() - ->save(Team::forceCreate([ - 'user_id' => $user->id, - 'name' => $fakeName . "'s Team", - 'personal_team' => true, - ])); - auth()->login($user, true); - - return to_route('welcome'); - } - } - } - - public function render() - { - return view('livewire.auth.login')->layout('layouts.guest'); - } -} diff --git a/app/Http/Livewire/Auth/LoginWithNDK.php b/app/Http/Livewire/Auth/LoginWithNDK.php deleted file mode 100644 index 8f677711..00000000 --- a/app/Http/Livewire/Auth/LoginWithNDK.php +++ /dev/null @@ -1,44 +0,0 @@ - 'required|string', - 'userProfile.pubkey' => 'required|string', - - 'userProfile.banner' => 'required|string', - 'userProfile.image' => 'required|string', - - 'userProfile.name' => 'required|string', - 'userProfile.username' => 'required|string', - 'userProfile.website' => 'required|string', - 'userProfile.about' => 'required|string', - 'userProfile.displayName' => 'required|string', - 'userProfile.lud16' => 'required|string', - 'userProfile.nip05' => 'required|string', - ]; - } - - public function updatedUserProfile($value) - { - if (User::query()->where('nostr', $value['npub'])->exists()) { - $this->existingAccount = true; - } - } - - public function render() - { - return view('livewire.auth.login-with-n-d-k')->layout('layouts.guest'); - } -} diff --git a/app/Http/Livewire/Banner/MempoolWeather.php b/app/Http/Livewire/Banner/MempoolWeather.php deleted file mode 100644 index 01ea2e2e..00000000 --- a/app/Http/Livewire/Banner/MempoolWeather.php +++ /dev/null @@ -1,30 +0,0 @@ -has('mempool-weather')) { - $this->weather = cache()->get('mempool-weather'); - } else { - Artisan::call(CacheRecommendedFees::class); - $this->weather = cache()->get('mempool-weather'); - } - $this->changed = cache()->get('mempool-weather-changed');*/ - } - - public function render() - { - return view('livewire.banner.mempool-weather'); - } -} diff --git a/app/Http/Livewire/BitcoinEvent/BitcoinEventTable.php b/app/Http/Livewire/BitcoinEvent/BitcoinEventTable.php deleted file mode 100644 index 30fe07a8..00000000 --- a/app/Http/Livewire/BitcoinEvent/BitcoinEventTable.php +++ /dev/null @@ -1,95 +0,0 @@ -year) { - $this->year = now()->year; - } - } - - public function render() - { - return view('livewire.bitcoin-event.bitcoin-event-table', [ - 'markers' => BitcoinEvent::query() - ->with([ - 'venue.city.country', - ]) - ->where('bitcoin_events.from', '>=', now()) - ->where(fn ($query) => $query - ->whereHas('venue.city.country', - fn ($query) => $query->where('countries.code', $this->country->code)) - ->orWhere('show_worldwide', true) - ) - ->get() - ->map(fn ($event) => [ - 'id' => $event->id, - 'name' => $event->title, - 'coords' => [$event->venue->city->latitude, $event->venue->city->longitude], - ]), - 'events' => BitcoinEvent::query() - ->where('bitcoin_events.from', '>=', now()) - ->where(fn ($query) => $query - ->whereHas('venue.city.country', - fn ($query) => $query->where('countries.code', $this->country->code)) - ->orWhere('show_worldwide', true) - ) - ->get() - ->map(fn ($event) => [ - 'id' => $event->id, - 'startDate' => $event->from, - 'endDate' => $event->to, - 'location' => $event->title, - 'description' => $event->description, - ]), - ])->layout('layouts.app', [ - 'SEOData' => new SEOData( - title: __('Bitcoin Events'), - description: __('Search out a Bitcoin Event'), - image: asset('img/screenshot.png') - ), - ]); - } - - public function filterByMarker($id) - { - return to_route('bitcoinEvent.table.bitcoinEvent', [ - '#table', - 'country' => $this->country->code, - 'year' => $this->year, - 'bitcoin_events' => [ - 'filters' => [ - 'byid' => $id, - ], - ], - ]); - } - - public function popover($content, $ids) - { - return to_route('bitcoinEvent.table.bitcoinEvent', [ - '#table', - 'country' => $this->country->code, - 'year' => $this->year, - 'bitcoin_events' => [ - 'filters' => [ - 'byid' => $ids, - ], - ], - ]); - } -} diff --git a/app/Http/Livewire/BitcoinEvent/Form/BitcoinEventForm.php b/app/Http/Livewire/BitcoinEvent/Form/BitcoinEventForm.php deleted file mode 100644 index 519cd092..00000000 --- a/app/Http/Livewire/BitcoinEvent/Form/BitcoinEventForm.php +++ /dev/null @@ -1,90 +0,0 @@ - [ - 'except' => null, - ], - ]; - - public function rules() - { - return [ - 'image' => [Rule::requiredIf(!$this->bitcoinEvent->id), 'nullable', 'mimes:jpeg,png,jpg,gif', 'max:10240'], - - 'bitcoinEvent.venue_id' => 'required', - 'bitcoinEvent.from' => 'required', - 'bitcoinEvent.to' => 'required', - 'bitcoinEvent.title' => 'required', - 'bitcoinEvent.description' => 'required', - 'bitcoinEvent.link' => 'required|url', - 'bitcoinEvent.show_worldwide' => 'bool', - ]; - } - - public function mount() - { - if (!$this->bitcoinEvent) { - $this->bitcoinEvent = new BitcoinEvent( - [ - 'description' => '', - 'show_worldwide' => true, - ] - ); - } elseif (!auth() - ->user() - ->can('update', $this->bitcoinEvent)) { - abort(403); - } - - if (!$this->fromUrl) { - $this->fromUrl = url()->previous(); - } - } - - public function deleteMe() - { - $this->bitcoinEvent->delete(); - - return redirect($this->fromUrl); - } - - public function submit() - { - $this->validate(); - $this->bitcoinEvent->save(); - - if ($this->image) { - $this->bitcoinEvent->addMedia($this->image) - ->usingFileName(md5($this->image->getClientOriginalName()).'.'.$this->image->getClientOriginalExtension()) - ->toMediaCollection('logo'); - } - - return redirect($this->fromUrl); - } - - public function render() - { - return view('livewire.bitcoin-event.form.bitcoin-event-form'); - } -} diff --git a/app/Http/Livewire/BookCase/BookCaseTable.php b/app/Http/Livewire/BookCase/BookCaseTable.php deleted file mode 100644 index 319ca8e1..00000000 --- a/app/Http/Livewire/BookCase/BookCaseTable.php +++ /dev/null @@ -1,48 +0,0 @@ - ! isset($this->table['filters']['byids']) ? [] - : BookCase::query() - ->whereIn('id', str($this->table['filters']['byids'] ?? '')->explode(',')) - ->get() - ->map(fn ($b) => [ - 'title' => $b->title, - 'lat' => $b->latitude, - 'lng' => $b->longitude, - 'url' => route('bookCases.comment.bookcase', ['country' => $this->country, 'bookCase' => $b]), - 'icon' => asset('img/btc-logo-6219386_1280.png'), - 'icon_size' => [42, 42], - ]) - ->toArray(), - 'bookCases' => BookCase::query()->active()->get(), - 'countries' => Country::query() - ->select(['code', 'name']) - ->get(), - ])->layout('layouts.app', [ - 'SEOData' => new SEOData( - title: __('Bookcases'), - description: __('Search out a public bookcase'), - image: asset('img/screenshot.png') - ), - ]); - } -} diff --git a/app/Http/Livewire/BookCase/CityTable.php b/app/Http/Livewire/BookCase/CityTable.php deleted file mode 100644 index b07c4204..00000000 --- a/app/Http/Livewire/BookCase/CityTable.php +++ /dev/null @@ -1,31 +0,0 @@ - [ - 'except' => false, - ], - ]; - - public function render() - { - return view('livewire.book-case.city-table')->layout('layouts.app', [ - 'SEOData' => new SEOData( - title: __('Bookcases'), - description: __('Search out a public bookcase'), - image: asset('img/screenshot.png') - ), - ]); - } -} diff --git a/app/Http/Livewire/BookCase/CommentBookCase.php b/app/Http/Livewire/BookCase/CommentBookCase.php deleted file mode 100644 index 3f9a0328..00000000 --- a/app/Http/Livewire/BookCase/CommentBookCase.php +++ /dev/null @@ -1,67 +0,0 @@ -validate([ - 'photo' => 'image|max:4096', // 4MB Max - ]); - - $this->bookCase - ->addMedia($this->photo) - ->usingFileName(md5($this->photo->getClientOriginalName()).'.'.$this->photo->getClientOriginalExtension()) - ->toMediaCollection('images'); - - return to_route('bookCases.comment.bookcase', ['country' => $this->country, 'bookCase' => $this->bookCase->id]); - } - - public function deletePhoto($id) - { - Media::find($id) - ->delete(); - - return to_route('bookCases.comment.bookcase', ['country' => $this->country, 'bookCase' => $this->bookCase->id]); - } - - public function render() - { - return view('livewire.book-case.comment-book-case') - ->layout('layouts.app', [ - 'SEOData' => new SEOData( - title: $this->bookCase->title, - description: $this->bookCase->address, - image: $this->bookCase->getFirstMediaUrl('images', 'seo') ?? asset('img/bookcase.jpg'), - ), - ]); - } - - protected function url_to_absolute($url) - { - if (str($url)->contains('http')) { - return $url; - } - if (!str($url)->contains('http')) { - return str($url)->prepend('https://'); - } - } -} diff --git a/app/Http/Livewire/BookCase/Form/OrangePillForm.php b/app/Http/Livewire/BookCase/Form/OrangePillForm.php deleted file mode 100644 index ad072c7c..00000000 --- a/app/Http/Livewire/BookCase/Form/OrangePillForm.php +++ /dev/null @@ -1,91 +0,0 @@ - ['except' => '']]; - - public function rules() - { - return [ - 'orangePill.book_case_id' => ['required'], - 'orangePill.user_id' => ['required'], - 'orangePill.amount' => ['required', 'numeric'], - 'orangePill.date' => ['required', 'date'], - 'orangePill.comment' => ['required', 'string'], - - 'image' => ['max:8192', Rule::requiredIf(!$this->orangePill->id), 'image', 'nullable'], // 8MB Max - ]; - } - - public function mount() - { - if (!$this->orangePill) { - $this->orangePill = new OrangePill([ - 'user_id' => auth()->id(), - 'book_case_id' => $this->bookCase->id, - 'date' => now(), - 'amount' => 1, - ]); - } elseif ($this->orangePill->user_id !== auth()->id()) { - abort(403); - } - if (!$this->fromUrl) { - $this->fromUrl = url()->previous(); - } - } - - public function save() - { - if (!auth()->check()) { - return to_route('auth.login'); - } - $this->validate(); - $this->orangePill->save(); - - if ($this->image) { - $this->orangePill - ->addMedia($this->image) - ->usingFileName(md5($this->image->getClientOriginalName()).'.'.$this->image->getClientOriginalExtension()) - ->toMediaCollection('images'); - } - - return redirect($this->fromUrl); - } - - public function deleteMe() - { - $this->orangePill->delete(); - auth() - ->user() - ->undoPoint(new BookCaseOrangePilled($this->orangePill)); - - return redirect($this->fromUrl); - } - - public function render() - { - return view('livewire.book-case.form.orange-pill-form'); - } -} diff --git a/app/Http/Livewire/BookCase/Heatmap.php b/app/Http/Livewire/BookCase/Heatmap.php deleted file mode 100644 index 52d403ea..00000000 --- a/app/Http/Livewire/BookCase/Heatmap.php +++ /dev/null @@ -1,34 +0,0 @@ -active() - ->whereHas('orangePills') - ->get() - ->map(fn ($bookCase) => [ - 'lat' => $bookCase->latitude, - 'lng' => $bookCase->longitude, - ]); - - return view('livewire.book-case.heatmap', [ - 'heatmap_data' => $data->toArray(), - ])->layout('layouts.app', [ - 'SEOData' => new SEOData( - title: __('Heatmap of Bookcases'), - description: __('On this map you can see the success and spread of the Bitcoin books.'), - image: asset('img/heatmap_bookcases.png'), - ), - ]); - } -} diff --git a/app/Http/Livewire/BookCase/HighscoreTable.php b/app/Http/Livewire/BookCase/HighscoreTable.php deleted file mode 100644 index 8d00d5f1..00000000 --- a/app/Http/Livewire/BookCase/HighscoreTable.php +++ /dev/null @@ -1,63 +0,0 @@ - User::query() - ->with([ - 'reputations', - ]) - ->withCount([ - 'orangePills', - ]) - ->where('reputation', '>', 0) - ->orderByDesc('reputation') - ->get(), - ])->layout('layouts.app', [ - 'SEOData' => new SEOData( - title: __('Highscore Table'), - description: __('Hall of fame of our honorable plebs'), - image: asset('img/highscore_table_screenshot.png'), - ), - ]); - } - - public function toggleChat() - { - $this->emit('toggleHighscoreChat'); - } - - public function openModal($id) - { - $this->modal = User::query() - ->with([ - 'orangePills', - 'reputations', - ]) - ->where('id', $id) - ->first(); - - $this->viewingModal = true; - } - - public function resetModal() - { - $this->modal = null; - $this->viewingModal = false; - } -} diff --git a/app/Http/Livewire/BookCase/Stats.php b/app/Http/Livewire/BookCase/Stats.php deleted file mode 100644 index 172b4496..00000000 --- a/app/Http/Livewire/BookCase/Stats.php +++ /dev/null @@ -1,18 +0,0 @@ - OrangePill::query()->count(), - 'plebs' => User::query()->whereHas('orangePills')->count(), - ]); - } -} diff --git a/app/Http/Livewire/BookCase/WorldMap.php b/app/Http/Livewire/BookCase/WorldMap.php deleted file mode 100644 index b5f07b66..00000000 --- a/app/Http/Livewire/BookCase/WorldMap.php +++ /dev/null @@ -1,41 +0,0 @@ - BookCase::query() - ->select(['id', 'latitude', 'longitude']) - ->withCount('orangePills') - ->active() - ->get() - ->map(fn ($bookCase) => [ - 'lat' => $bookCase->latitude, - 'lng' => $bookCase->longitude, - 'url' => url()->route('bookCases.comment.bookcase', - [ - 'country' => $this->country, - 'bookCase' => $bookCase, - ]), - 'op' => $bookCase->orange_pills_count, - ]) - ->toArray(), - ])->layout('layouts.app', [ - 'SEOData' => new SEOData( - title: __('World Map of Bookcases'), - description: __('On this map you can see bookcases that have been orange pilled. You can also click on a marker to go to the search result.'), - image: asset('img/world_map_bookcases.png') - ), - ]); - } -} diff --git a/app/Http/Livewire/Chat/HighscoreChat.php b/app/Http/Livewire/Chat/HighscoreChat.php deleted file mode 100644 index ec0915c5..00000000 --- a/app/Http/Livewire/Chat/HighscoreChat.php +++ /dev/null @@ -1,72 +0,0 @@ - 'required|min:1|max:255', - ]; - } - - public function getListeners() - { - return [ - 'toggleHighscoreChat' => 'toggle', - 'echo:plebchannel,.App\Events\ChatMessageSentEvent' => 'chatMessageSent', - ]; - } - - public function mount() - { - $this->messages = cache()->get('highscore_chat_messages', []); - } - - public function toggle() - { - $this->open = ! $this->open; - } - - public function chatMessageSent() - { - if (auth()->check()) { - $this->messages = cache()->get('highscore_chat_messages', []); - $this->dispatchBrowserEvent('chat-updated'); - } - } - - public function sendMessage() - { - $this->validate(); - $newMessages = collect(cache()->get('highscore_chat_messages', [])) - ->push([ - 'fromId' => auth()->id(), - 'fromName' => str(auth()->user()->name)->limit(2), - 'userImg' => str(auth()->user()->profile_photo_url)->replace('background=EBF4FF', 'background=F7931A'), - 'message' => $this->myNewMessage, - 'time' => now()->asDateTime(), - ]) - ->take(-21) - ->toArray(); - cache()->set('highscore_chat_messages', $newMessages); - event(new ChatMessageSentEvent()); - $this->messages = $newMessages; - $this->myNewMessage = ''; - } - - public function render() - { - return view('livewire.chat.highscore-chat'); - } -} diff --git a/app/Http/Livewire/City/Form/CityForm.php b/app/Http/Livewire/City/Form/CityForm.php deleted file mode 100644 index 7be7187f..00000000 --- a/app/Http/Livewire/City/Form/CityForm.php +++ /dev/null @@ -1,63 +0,0 @@ - [ - 'except' => null, - ], - ]; - - public function rules() - { - return [ - 'city.country_id' => 'required', - 'city.name' => [ - 'required', - Rule::unique('cities', 'name') - ->ignore($this->city), - ], - 'city.longitude' => 'required', - 'city.latitude' => 'required', - ]; - } - - public function mount() - { - if (!$this->city) { - $this->city = new City(); - } - if (!$this->fromUrl) { - $this->fromUrl = url()->previous(); - } - } - - public function save() - { - $this->validate(); - $this->city->longitude = str($this->city->longitude) - ->replace(',', '.') - ->toFloat(); - $this->city->latitude = str($this->city->latitude) - ->replace(',', '.') - ->toFloat(); - $this->city->save(); - - return redirect($this->fromUrl ?? url()->route('welcome')); - } - - public function render() - { - return view('livewire.city.form.city-form'); - } -} diff --git a/app/Http/Livewire/ContentCreator/Form/ContentCreatorForm.php b/app/Http/Livewire/ContentCreator/Form/ContentCreatorForm.php deleted file mode 100644 index aa775d0e..00000000 --- a/app/Http/Livewire/ContentCreator/Form/ContentCreatorForm.php +++ /dev/null @@ -1,76 +0,0 @@ - ['except' => '']]; - - public function rules() - { - return [ - 'image' => [Rule::requiredIf(!$this->lecturer->id), 'nullable', 'mimes:jpeg,png,jpg,gif', 'max:10240'], - - 'lecturer.name' => [ - 'required', - Rule::unique('lecturers', 'name') - ->ignore($this->lecturer), - ], - 'lecturer.active' => 'boolean', - 'lecturer.subtitle' => 'nullable|string', - 'lecturer.intro' => 'nullable|string', - 'lecturer.paynym' => 'nullable|string', - 'lecturer.nostr' => 'nullable|string', - 'lecturer.twitter_username' => 'nullable|string', - 'lecturer.website' => 'nullable|url', - 'lecturer.lightning_address' => 'nullable|string', - 'lecturer.lnurl' => 'nullable|string', - 'lecturer.node_id' => 'nullable|string', - ]; - } - - public function mount() - { - if (!$this->lecturer) { - $this->lecturer = new Lecturer([ - 'intro' => '', - 'active' => true, - ]); - } - if (!$this->fromUrl) { - $this->fromUrl = url()->previous(); - } - } - - public function save() - { - $this->validate(); - $this->lecturer->save(); - - if ($this->image) { - $this->lecturer->addMedia($this->image) - ->usingFileName(md5($this->image->getClientOriginalName()).'.'.$this->image->getClientOriginalExtension()) - ->toMediaCollection('avatar'); - } - - return redirect($this->fromUrl); - } - - public function render() - { - return view('livewire.content-creator.form.content-creator-form'); - } -} diff --git a/app/Http/Livewire/Frontend/Footer.php b/app/Http/Livewire/Frontend/Footer.php deleted file mode 100644 index 18cfd055..00000000 --- a/app/Http/Livewire/Frontend/Footer.php +++ /dev/null @@ -1,37 +0,0 @@ -where('language', $l) - ->first(); - if (!$language || str($l)->contains('ey')) { - $language = Language::query() - ->where('language', config('app.locale')) - ->first(); - } - $translated = $language->translations() - ->whereNotNull('value') - ->where('value', '<>', '') - ->count(); - $toTranslate = Translation::query() - ->where('language_id', $language->id) - ->count(); - $toTranslate = $toTranslate > 0 ? $toTranslate : 1; - - return view('livewire.frontend.footer', [ - 'percentTranslated' => $l === 'en' ? 100 : round(($translated / $toTranslate) * 100), - 'language' => $language, - ]); - } -} diff --git a/app/Http/Livewire/Frontend/Header.php b/app/Http/Livewire/Frontend/Header.php deleted file mode 100644 index abaa1956..00000000 --- a/app/Http/Livewire/Frontend/Header.php +++ /dev/null @@ -1,162 +0,0 @@ - '$refresh']; - - public function rules() - { - return [ - 'c' => 'required', - 'l' => 'required', - 'timezone' => 'required', - ]; - } - - public function mount() - { - $this->timezone = config('app.user-timezone'); - $this->l = Cookie::get('lang') ?: config('app.locale'); - $this->c = Cookie::get('country') ?: config('app.country'); - if (!$this->country) { - $this->country = Country::query() - ->where('code', $this->c) - ->first(); - } - $this->currentRouteName = Route::currentRouteName(); - } - - public function updatedTimezone($value) - { - auth() - ->user() - ->update(['timezone' => $value]); - - return redirect(request()->header('Referer')); - } - - public function updatedC($value) - { - Cookie::queue('country', $value, 60 * 24 * 365); - $url = str(request()->header('Referer'))->explode('/'); - $url[3] = $value; - - return redirect($url->implode('/')); - } - - public function updatedL($value) - { - Cookie::queue('lang', $value, 60 * 24 * 365); - - return redirect(request()->header('Referer')); - } - - public function render() - { - return view('livewire.frontend.header', [ - 'news' => LibraryItem::query() - ->with([ - 'createdBy.roles', - 'lecturer', - 'tags', - ]) - ->where('type', 'markdown_article') - ->where('approved', true) - ->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') - ->orderByDesc('created_at') - ->take(2) - ->get(), - 'bitcoinEvents' => BitcoinEvent::query() - ->with([ - 'venue', - ]) - ->where('from', '>', now()) - ->orderBy('from') - ->take(2) - ->get(), - 'orangePills' => OrangePill::query() - ->with([ - 'user', - 'bookCase', - ]) - ->orderByDesc('date') - ->take(2) - ->get(), - 'projectProposals' => ProjectProposal::query() - ->with([ - 'votes', - 'user', - ]) - ->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; - }), - ]); - } -} diff --git a/app/Http/Livewire/Frontend/SearchTabs.php b/app/Http/Livewire/Frontend/SearchTabs.php deleted file mode 100644 index 691835c9..00000000 --- a/app/Http/Livewire/Frontend/SearchTabs.php +++ /dev/null @@ -1,15 +0,0 @@ - 'required', - 'l' => 'required', - ]; - } - - public function mount() - { - $this->l = Cookie::get('lang') ?: config('app.locale'); - $this->c = Cookie::get('country') ?: config('app.country'); - Cookie::queue('lang', $this->l, 60 * 24 * 365); - Cookie::queue('country', $this->c, 60 * 24 * 365); - } - - public function updated($property, $value) - { - $this->validate(); - if ($property === 'c') { - $c = $value; - } else { - $c = $this->c; - } - if ($property === 'l') { - $l = $value; - } else { - $l = $this->l; - } - - Cookie::queue('lang', $this->l, 60 * 24 * 365); - Cookie::queue('country', $this->c, 60 * 24 * 365); - - return to_route('welcome', ['c' => $c, 'l' => $l]); - } - - public function render() - { - return view('livewire.frontend.welcome', [ - '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; - }), - ])->layout('layouts.guest', [ - 'SEOData' => new SEOData( - title: __('Welcome'), - description: __('Welcome to the portal of the Einundzwanzig Community.'), - image: url()->route('imgPublic', ['path' => 'img/screenshot.png', 'h' => 630, 'w' => 1200, 'fit' => 'crop']) - ), - ]); - } -} diff --git a/app/Http/Livewire/Guest/Welcome.php b/app/Http/Livewire/Guest/Welcome.php deleted file mode 100644 index 8ebe9337..00000000 --- a/app/Http/Livewire/Guest/Welcome.php +++ /dev/null @@ -1,13 +0,0 @@ -layout('layouts.guest'); - } -} diff --git a/app/Http/Livewire/Hello.php b/app/Http/Livewire/Hello.php deleted file mode 100644 index e7fdf965..00000000 --- a/app/Http/Livewire/Hello.php +++ /dev/null @@ -1,87 +0,0 @@ - 'required|string|max:1000', - ]; - } - - public function mount() - { - try { - // {"url":"","wallet_id":"","read_key":""} - $invoice = $this->createInvoice( - sats: 21, - memo: 'Payment for: Bitcoin im Ländle 2023 - Code is Speech', - lnbits: [ - 'url' => config('services.lnbits.url'), - 'wallet_id' => config('services.lnbits.wallet_id'), - 'read_key' => config('services.lnbits.read_key'), - ], - ); - } catch (\Exception $e) { - $this->notification() - ->error('LNBits error: '.$e->getMessage()); - - return; - } - - $this->paymentHash = $invoice['payment_hash']; - $this->qrCode = base64_encode(QrCode::format('png') - ->size(300) - ->merge('/public/img/markus_turm.png', .3) - ->errorCorrection('H') - ->generate($invoice['payment_request'])); - $this->invoice = $invoice['payment_request']; - $this->checkid = $invoice['checking_id']; - } - - public function checkPaymentHash() - { - try { - $invoice = $this->check($this->checkid, [ - 'url' => config('services.lnbits.url'), - 'wallet_id' => config('services.lnbits.wallet_id'), - 'read_key' => config('services.lnbits.read_key'), - ]); - } catch (\Exception $e) { - $this->notification() - ->error('LNBits error: '.$e->getMessage()); - - return; - } - if (isset($invoice['paid']) && $invoice['paid']) { - $this->invoicePaid = true; - event(new PaidMessageEvent($this->message, $this->checkid)); - } else { - Log::error(json_encode($invoice, JSON_THROW_ON_ERROR)); - } - } - - public function render() - { - return view('livewire.hello')->layout('layouts.guest'); - } -} diff --git a/app/Http/Livewire/Library/Form/LibraryItemForm.php b/app/Http/Livewire/Library/Form/LibraryItemForm.php deleted file mode 100644 index 1b356be5..00000000 --- a/app/Http/Livewire/Library/Form/LibraryItemForm.php +++ /dev/null @@ -1,198 +0,0 @@ - ['except' => ''], - 'lecturer' => ['except' => false], - 'isBindle' => ['except' => false], - ]; - - public function rules() - { - return [ - 'image' => [Rule::requiredIf(!$this->libraryItem->id), 'nullable', 'mimes:jpeg,png,jpg,gif', 'max:10240'], - - 'library' => 'required', - - 'selectedTags' => 'array|min:1', - - 'libraryItem.lecturer_id' => 'required', - 'libraryItem.name' => 'required', - 'libraryItem.type' => 'required', - 'libraryItem.language_code' => 'required', - 'libraryItem.value' => [ - Rule::when($this->libraryItem->type !== LibraryItemType::DownloadableFile(), 'required'), - Rule::when( - $this->libraryItem->type !== LibraryItemType::MarkdownArticle() - && $this->libraryItem->type !== LibraryItemType::MarkdownArticleExtern(), ['url'] - ), - ], - 'libraryItem.subtitle' => - [ - Rule::when( - $this->libraryItem->type !== 'bindle', - 'required', - ) - ], - 'libraryItem.excerpt' => - [ - Rule::when( - $this->libraryItem->type !== 'bindle', - 'required', - ) - ], - 'libraryItem.main_image_caption' => - [ - Rule::when( - $this->libraryItem->type !== 'bindle', - 'required', - ) - ], - 'libraryItem.read_time' => - [ - Rule::when( - $this->libraryItem->type !== 'bindle', - 'required', - ) - ], - 'libraryItem.approved' => - [ - Rule::when( - $this->libraryItem->type !== 'bindle', - 'required', - ) - ], - ]; - } - - public function mount() - { - if (!$this->libraryItem) { - $this->libraryItem = new LibraryItem([ - 'approved' => true, - 'read_time' => 1, - 'value' => '' - ]); - if ($this->lecturer) { - $this->library = Library::query() - ->firstWhere('name', '=', 'Dozentenmaterial')?->id; - } - } else { - $this->selectedTags = $this->libraryItem->tags() - ->where('type', 'library_item') - ->get() - ->map(fn($tag) => $tag->name) - ->toArray(); - $this->library = $this->libraryItem->libraries() - ->first() - ->id; - } - if (!$this->fromUrl) { - $this->fromUrl = url()->previous(); - } - if ($this->isBindle) { - $this->library = 21; - $this->libraryItem->lecturer_id = 125; - $this->libraryItem->type = 'bindle'; - $this->libraryItem->language_code = 'de'; - $this->selectedTags = ['Bindle']; - } - } - - public function save() - { - $this->validate(); - $this->libraryItem->save(); - $this->libraryItem->setStatus('published'); - - $this->libraryItem->syncTagsWithType( - $this->selectedTags, - 'library_item' - ); - - if ($this->image) { - $this->libraryItem->addMedia($this->image) - ->usingFileName(md5($this->image->getClientOriginalName()) . '.' . $this->image->getClientOriginalExtension()) - ->toMediaCollection('main'); - } - - if ($this->file) { - $this->libraryItem->addMedia($this->file) - ->usingFileName(md5($this->file->getClientOriginalName()) . '.' . $this->file->getClientOriginalExtension()) - ->toMediaCollection('single_file'); - } - - $this->libraryItem->libraries() - ->syncWithoutDetaching([(int)$this->library]); - - if ($this->libraryItem->type === 'bindle') { - return to_route('bindles'); - } - - return to_route('library.table.libraryItems', ['country' => $this->country]); - } - - public function render() - { - $types = Options::forEnum(LibraryItemType::class) - ->filter( - fn($type) => $type !== LibraryItemType::PodcastEpisode - && $type !== LibraryItemType::MarkdownArticle - ) - ->toArray(); - $libaries = Library::query() - ->when(auth()->id() != config('portal.bonus.fiat-tracker-user-id'), - fn($query) => $query->where('name', '!=', 'Bindle') - ) - ->get() - ->map(fn($library) => [ - 'id' => $library->id, - 'name' => $library->name, - ]) - ->toArray(); - - if (auth()->id() == config('portal.bonus.fiat-tracker-user-id')) { - $types = collect($types)->prepend([ - 'label' => 'Bindle', - 'value' => 'bindle', - ]); - } - - return view('livewire.library.form.library-item-form', [ - 'types' => $types, - 'libraries' => $libaries, - ]); - } -} diff --git a/app/Http/Livewire/Library/LibraryTable.php b/app/Http/Livewire/Library/LibraryTable.php deleted file mode 100644 index e0207f92..00000000 --- a/app/Http/Livewire/Library/LibraryTable.php +++ /dev/null @@ -1,129 +0,0 @@ - ['except' => '*'], - 'filters' => ['except' => ''], - 'search' => ['except' => ''], - ]; - - public function loadMore() - { - $this->perPage += 9; - } - - public function mount() - { - if (str(request() - ->route() - ->getName())->contains(['.lecturer'])) { - $this->isLecturerPage = true; - } - } - - public function resetFiltering($isLecturerPage = false) - { - if ($isLecturerPage) { - return to_route('library.table.lecturer', ['country' => $this->country, 'currentTab' => '*']); - } else { - return to_route('library.table.libraryItems', ['country' => $this->country, 'currentTab' => '*']); - } - } - - public function render() - { - $shouldBePublic = !$this->isLecturerPage; - $libraries = \App\Models\Library::query() - ->where('name', '!=', 'Bindle') - ->whereNull('parent_id') - ->where('is_public', $shouldBePublic) - ->orderBy('name') - ->get(); - $tabs = collect([ - [ - 'name' => '*', - ], - ]); - foreach ($libraries as $library) { - $tabs->push([ - 'name' => $library->name, - ]); - } - - if ($this->currentTab !== '*') { - $parentLibrary = Library::query() - ->where('name', $this->currentTab) - ->first(); - } - $searchTags = []; - if ($this->search) { - $searchTags = Tag::where('name', 'ilike', '%' . $this->search . '%') - ->pluck('id') - ->toArray(); - } - - return view('livewire.library.library-table', [ - 'libraries' => $tabs, - 'libraryItems' => LibraryItem::query() - ->with([ - 'lecturer', - 'tags', - ]) - ->where('type', '!=', 'bindle') - ->when($this->search, fn($query) => $query - ->where('name', 'ilike', '%' . $this->search . '%') - ->orWhere(fn($query) => $query - ->when(count($searchTags) > 0 && count($this->filters) < 1, - fn($query) => $query->whereHas('tags', - fn($query) => $query->whereIn('tags.id', $searchTags))) - ) - ) - ->when($this->currentTab !== '*', fn($query) => $query - ->whereHas('libraries', - fn($query) => $query - ->where('libraries.name', $this->currentTab) - ) - ) - ->when(isset($this->filters['lecturer_id']), - fn($query) => $query->where('library_items.lecturer_id', - $this->filters['lecturer_id']) - ) - ->when(isset($this->filters['tag']), fn($query) => $query->whereHas('tags', - fn($query) => $query->whereIn('tags.id', $this->filters['tag']))) - ->when(isset($this->filters['language']), - fn($query) => $query->whereIn('language_code', $this->filters['language'])) - ->whereHas('libraries', - fn($query) => $query->where('libraries.is_public', $shouldBePublic)) - ->orderByDesc('library_items.created_at') - ->paginate($this->perPage), - ])->layout('layouts.app', [ - 'SEOData' => new SEOData( - title: __('Library'), - description: __('Here you can find all content that are available in the library.'), - image: asset('img/screenshot.png') - ), - ]); - } -} diff --git a/app/Http/Livewire/Library/PodcastEpisodesTable.php b/app/Http/Livewire/Library/PodcastEpisodesTable.php deleted file mode 100644 index 3b68ae6f..00000000 --- a/app/Http/Livewire/Library/PodcastEpisodesTable.php +++ /dev/null @@ -1,60 +0,0 @@ - ['except' => ''], - 'search' => ['except' => ''], - ]; - - public function loadMore() - { - $this->perPage += 9; - } - - public function resetFiltering($isLecturerPage = false) - { - return to_route('library.table.podcastsEpisodes', ['country' => $this->country]); - } - - public function render() - { - return view('livewire.library.podcast-episodes-table', [ - 'episodes' => Episode::query() - ->with(['podcast']) - ->whereNot('data->link', '=', '') - ->when($this->search, - fn($query, $search) => $query - ->where('data->title', 'ilike', "%{$search}%") - ->orWhere('data->description', 'ilike', "%{$search}%") - ->orWhereHas('podcast', - fn($query) => $query->where('data->title', 'ilike', "%{$search}%")) - ) - ->orderByDesc('data->datePublished') - ->paginate($this->perPage), - ])->layout('layouts.app', [ - 'SEOData' => new SEOData( - title: __('Podcast Episodes'), - description: __('Search and find Bitcoin Podcast episodes.'), - image: asset('img/Screenshot_Podcast_Episodes.png') - ), - ]); - } -} diff --git a/app/Http/Livewire/Library/SearchByTagComponent.php b/app/Http/Livewire/Library/SearchByTagComponent.php deleted file mode 100644 index 69d36ef7..00000000 --- a/app/Http/Livewire/Library/SearchByTagComponent.php +++ /dev/null @@ -1,51 +0,0 @@ - ['except' => ''], - ]; - - public function render() - { - $shouldBePublic = request() - ->route() - ->getName() !== 'library.table.lecturer'; - - return view('livewire.library.search-by-tag-component', [ - 'languages' => LibraryItem::query() - ->pluck('language_code') - ->unique() - ->sort() - ->map(fn ($item) => str($item) - ->before('_') - ->toString()) - ->values() - ->toArray(), - 'tags' => Tag::query() - ->with([ - 'libraryItems.libraries', - 'libraryItems.lecturer', - ]) - ->withCount([ - 'libraryItems', - ]) - ->where('type', 'library_item') - ->whereHas('libraryItems.libraries', - fn ($query) => $query->where('is_public', $shouldBePublic)) - ->orderByDesc('library_items_count') - ->orderBy('tags.id') - ->get(), - ]); - } -} diff --git a/app/Http/Livewire/Meetup/Embed/CountryMap.php b/app/Http/Livewire/Meetup/Embed/CountryMap.php deleted file mode 100644 index 9317eda9..00000000 --- a/app/Http/Livewire/Meetup/Embed/CountryMap.php +++ /dev/null @@ -1,46 +0,0 @@ - ['except' => false]]; - - public function render() - { - return view('livewire.meetup.embed.country-map', [ - 'markers' => Meetup::query() - ->with([ - 'city.country', - ]) - ->whereHas('city.country', - fn($query) => $query->where('countries.code', $this->country->code)) - ->get() - ->map(fn($meetup) => [ - 'id' => $meetup->id, - 'name' => $meetup->name, - 'coords' => [$meetup->city->latitude, $meetup->city->longitude], - 'url' => url()->route('meetup.landing', [ - 'country' => $meetup->city->country->code, - 'meetup' => $meetup, - ]), - ]), - ])->layout('layouts.app', [ - 'darkModeDisabled' => !$this->darkMode, - 'SEOData' => new SEOData( - title: __('Meetups'), - description: __('Bitcoiner Meetups are a great way to meet other Bitcoiners in your area. You can learn from each other, share ideas, and have fun!'), - image: asset('img/screenshot.png') - ), - ]); - } -} diff --git a/app/Http/Livewire/Meetup/Form/MeetupEventForm.php b/app/Http/Livewire/Meetup/Form/MeetupEventForm.php deleted file mode 100644 index cc2338b7..00000000 --- a/app/Http/Livewire/Meetup/Form/MeetupEventForm.php +++ /dev/null @@ -1,174 +0,0 @@ - ['except' => '']]; - - public function rules() - { - return [ - 'meetupEvent.meetup_id' => 'required', - 'meetupEvent.start' => 'required', - 'meetupEvent.location' => 'string|max:255|nullable', - 'meetupEvent.description' => 'string|nullable', - 'meetupEvent.link' => 'url|max:255|nullable', - - 'series' => 'array', - 'series.*.start' => 'required', - - 'recurring' => 'bool', - 'repetitions' => 'numeric|min:1', - ]; - } - - public function mount() - { - if (!$this->meetupEvent) { - $this->meetupEvent = new MeetupEvent( - [ - 'start' => now() - ->startOfDay() - ->addHours(17), - ] - ); - } elseif (!auth() - ->user() - ->can('update', $this->meetupEvent)) { - abort(403); - } - if (!$this->fromUrl) { - $this->fromUrl = url()->previous(); - } - } - - public function updatedMeetupEventStart($value) - { - $this->validateOnly('meetupEvent.start'); - if ($this->recurring) { - $this->updatedRecurring(true); - } - } - - public function updatedRecurring($value) - { - $this->validateOnly('recurring'); - $series = []; - if ($value && $this->meetupEvent->start) { - for ($i = 0; $i < $this->repetitions; $i++) { - $series[] = [ - 'start' => $this->meetupEvent->start->addMonths($i + 1) - ->toDateTimeString(), - ]; - } - } - $this->series = $series; - } - - public function updatedRepetitions($value) - { - $this->validateOnly('repetitions'); - if ($this->recurring) { - $this->updatedRecurring(true, $value); - } - } - - public function deleteMe() - { - $this->dialog() - ->confirm( - [ - 'title' => __('Delete event'), - 'description' => __('Are you sure you want to delete this event? This action cannot be undone.'), - 'icon' => 'warning', - 'accept' => [ - 'label' => __('Yes, delete'), - 'method' => 'deleteEvent', - ], - 'reject' => [ - 'label' => __('No, cancel'), - 'method' => 'cancel', - ], - ] - ); - } - - public function deleteEvent() - { - $this->meetupEvent->delete(); - - return to_route('meetup.table.meetupEvent', ['country' => $this->country]); - } - - public function submit() - { - $this->validate(); - if (!$this->meetupEvent->id) { - $hasAppointmentsOnThisDate = MeetupEvent::query() - ->where('meetup_id', $this->meetupEvent->meetup_id) - ->where('start', '>', Carbon::parse($this->meetupEvent->start) - ->startOfDay()) - ->where('start', '<', Carbon::parse($this->meetupEvent->start) - ->endOfDay()) - ->exists(); - if ($hasAppointmentsOnThisDate) { - $this->notification() - ->warning(__('There is already an event on this date. Please choose another date or delete the existing events.')); - - return; - } - } - - $this->meetupEvent->save(); - - if ($this->recurring) { - foreach ($this->series as $event) { - $hasAppointmentsOnThisDate = MeetupEvent::query() - ->where('meetup_id', $this->meetupEvent->meetup_id) - ->where('start', '>', Carbon::parse($event['start']) - ->startOfDay()) - ->where('start', '<', Carbon::parse($event['start']) - ->endOfDay()) - ->exists(); - - if ($hasAppointmentsOnThisDate) { - continue; - } - - $this->meetupEvent->replicate() - ->fill($event) - ->saveQuietly(); - } - } - - $this->notification() - ->success(__('Event saved successfully.')); - - return to_route('meetup.table.meetupEvent', ['country' => $this->country]); - } - - public function render() - { - return view('livewire.meetup.form.meetup-event-form'); - } -} diff --git a/app/Http/Livewire/Meetup/Form/MeetupForm.php b/app/Http/Livewire/Meetup/Form/MeetupForm.php deleted file mode 100644 index a2213908..00000000 --- a/app/Http/Livewire/Meetup/Form/MeetupForm.php +++ /dev/null @@ -1,93 +0,0 @@ - [ - 'except' => null, - ], - ]; - - public function rules() - { - return [ - 'image' => [Rule::requiredIf(!$this->meetup->id), 'nullable', 'mimes:jpeg,png,jpg,gif', 'max:10240'], - - 'meetup.city_id' => 'required', - 'meetup.name' => [ - 'required', - Rule::unique('meetups', 'name') - ->ignore($this->meetup), - ], - 'meetup.community' => 'required', - 'meetup.telegram_link' => 'string|nullable|required_without_all:meetup.webpage,meetup.nostr,meetup.twitter_username,meetup.matrix_group', - 'meetup.intro' => 'string|nullable', - 'meetup.webpage' => 'string|url|nullable|required_without_all:meetup.telegram_link,meetup.nostr,meetup.twitter_username,meetup.matrix_group', - 'meetup.nostr' => 'string|nullable|required_without_all:meetup.webpage,meetup.telegram_link,meetup.twitter_username,meetup.matrix_group', - 'meetup.twitter_username' => 'string|regex:/^[A-z0-9!@]+$/|nullable|required_without_all:meetup.webpage,meetup.telegram_link,meetup.nostr,meetup.matrix_group', - 'meetup.matrix_group' => 'string|nullable|required_without_all:meetup.webpage,meetup.telegram_link,meetup.nostr,meetup.twitter_username', - 'meetup.simplex' => 'string|nullable', - ]; - } - - public function mount() - { - if (!$this->meetup) { - $this->meetup = new Meetup([ - 'community' => 'einundzwanzig', - ]); - } elseif ( - !auth() - ->user() - ->can('update', $this->meetup) - ) { - abort(403); - } - if (!$this->fromUrl) { - $this->fromUrl = url()->previous(); - } - } - - public function submit() - { - $this->validate(); - $this->meetup->save(); - - if ($this->image) { - $this->meetup->addMedia($this->image) - ->usingFileName(md5($this->image->getClientOriginalName()) . '.' . $this->image->getClientOriginalExtension()) - ->toMediaCollection('logo'); - } - - auth() - ->user() - ->meetups() - ->syncWithoutDetaching($this->meetup->id); - - return redirect($this->fromUrl); - } - - public function render() - { - return view('livewire.meetup.form.meetup-form'); - } -} diff --git a/app/Http/Livewire/Meetup/LandingPage.php b/app/Http/Livewire/Meetup/LandingPage.php deleted file mode 100644 index 1377b63c..00000000 --- a/app/Http/Livewire/Meetup/LandingPage.php +++ /dev/null @@ -1,68 +0,0 @@ -meetup->load([ - 'media', - ]); - } - - public function render() - { - return view('livewire.meetup.landing-page', [ - 'meetupEvents' => MeetupEvent::query() - ->with([ - 'meetup.city.country', - ]) - ->where('meetup_events.meetup_id', $this->meetup->id) - ->where('meetup_events.start', '>=', now()->subDay()) - ->orderBy('start') - ->get(), - 'events' => MeetupEvent::query() - ->with([ - 'meetup.city.country', - ]) - ->where('meetup_events.meetup_id', $this->meetup->id) - ->where('meetup_events.start', '>=', now()->subDay()) - ->orderBy('start') - ->get() - ->map(fn ($event) => [ - 'id' => $event->id, - 'startDate' => $event->start, - 'endDate' => $event->start->addHours(1), - 'location' => $event->location, - 'description' => $event->description, - ]), - ]) - ->layout('layouts.guest', [ - 'SEOData' => new SEOData( - title: $this->meetup->name, - description: __('Bitcoiner Meetups are a great way to meet other Bitcoiners in your area. You can learn from each other, share ideas, and have fun!'), - image: $this->meetup->getFirstMediaUrl('logo'), - ), - ]); - } - - public function showEvent($id) - { - $this->activeEvent = $id; - } -} diff --git a/app/Http/Livewire/Meetup/LandingPageEvent.php b/app/Http/Livewire/Meetup/LandingPageEvent.php deleted file mode 100644 index 4087dc75..00000000 --- a/app/Http/Livewire/Meetup/LandingPageEvent.php +++ /dev/null @@ -1,209 +0,0 @@ - [ - 'required', - new UniqueAttendeeName($this->meetupEvent), - ], - ]; - } - - public function mount() - { - $this->meetupEvent->load('meetup.users'); - $this->meetup = $this->meetupEvent->meetup; - $this->name = auth()->check() ? auth()->user()->name : ''; - $this->checkShowUp(); - } - - public function checkShowUp() - { - $attendees = collect($this->meetupEvent->attendees); - $mightAttendees = collect($this->meetupEvent->might_attendees); - - if (auth()->check() && $attendees->contains(fn($value) => str($value)->contains('id_'.auth()->id()))) { - $this->name = str($attendees->filter(fn($value) => str($value)->contains('id_'.auth()->id())) - ->first()) - ->after('|') - ->toString(); - $this->willShowUp = true; - } - - if (!auth()->check() && $attendees->contains(fn($value) => str($value)->contains('anon_'.session()->getId()))) { - $this->name = str($attendees->filter(fn($value) => str($value)->contains('anon_'.session()->getId())) - ->first()) - ->after('|') - ->toString(); - $this->willShowUp = true; - } - - if (auth()->check() && $mightAttendees->contains(fn($value) => str($value)->contains('id_'.auth()->id()))) { - $this->name = str($mightAttendees->filter(fn($value) => str($value)->contains('id_'.auth()->id())) - ->first()) - ->after('|') - ->toString(); - $this->perhapsShowUp = true; - } - - if (!auth()->check() && $mightAttendees->contains(fn($value - ) => str($value)->contains('anon_'.session()->getId()))) { - $this->name = str($mightAttendees->filter(fn($value) => str($value)->contains('anon_'.session()->getId())) - ->first()) - ->after('|') - ->toString(); - $this->perhapsShowUp = true; - } - - $this->attendees = $this->mapAttendees($attendees); - $this->mightAttendees = $this->mapAttendees($mightAttendees); - } - - private function mapAttendees($collection) { - return $collection->map(function ($value) { - if (str($value)->contains('anon_')) { - $id = -1; - } else { - $id = str($value) - ->before('|') - ->after('id_') - ->toString(); - } - - return [ - 'id' => $id, - 'user' => $id > 0 ? User::withoutEvents(static fn() => User::query() - ->select([ - 'id', - 'name', - 'profile_photo_path', - ]) - ->find($id) - ?->append('profile_photo_url') - ->toArray()) - : null, - 'name' => str($value) - ->after('|') - ->toString(), - ]; - }) - ->toArray(); - } - - public function cannotCome() - { - $attendees = collect($this->meetupEvent->attendees); - $mightAttendees = collect($this->meetupEvent->might_attendees); - - if (auth()->check() && $attendees->contains(fn($value) => str($value)->contains('id_'.auth()->id()))) { - $attendees = $attendees->filter(fn($value) => !str($value)->contains('id_'.auth()->id())); - $this->willShowUp = false; - } - - if (!auth()->check() && $attendees->contains(fn($value) => str($value)->contains('anon_'.session()->getId()))) { - $attendees = $attendees->filter(fn($value) => !str($value)->contains('anon_'.session()->getId())); - $this->willShowUp = false; - } - - if (auth()->check() && $mightAttendees->contains(fn($value) => str($value)->contains('id_'.auth()->id()))) { - $mightAttendees = $mightAttendees->filter(fn($value) => !str($value)->contains('id_'.auth()->id())); - $this->perhapsShowUp = false; - } - - if (!auth()->check() && $mightAttendees->contains(fn($value - ) => str($value)->contains('anon_'.session()->getId()))) { - $mightAttendees = $mightAttendees->filter(fn($value) => !str($value)->contains('anon_'.session()->getId())); - $this->perhapsShowUp = false; - } - - $this->meetupEvent->update([ - 'attendees' => $attendees->toArray(), - 'might_attendees' => $mightAttendees->toArray(), - ]); - - $this->checkShowUp(); - } - - public function attend() - { - $this->validate(); - $attendees = collect($this->meetupEvent->attendees); - - if (auth()->check() && !$attendees->contains('id_'.auth()->id().'|'.$this->name)) { - $attendees->push('id_'.auth()->id().'|'.$this->name); - $this->willShowUp = true; - } - - if (!auth()->check() && !$attendees->contains('anon_'.session()->getId().'|'.$this->name)) { - $attendees->push('anon_'.session()->getId().'|'.$this->name); - $this->willShowUp = true; - } - - $this->meetupEvent->update([ - 'attendees' => $attendees->toArray(), - ]); - - $this->checkShowUp(); - } - - public function mightAttend() - { - $this->validate(); - $mightAttendees = collect($this->meetupEvent->might_attendees); - - if (auth()->check() && !$mightAttendees->contains('id_'.auth()->id().'|'.$this->name)) { - $mightAttendees->push('id_'.auth()->id().'|'.$this->name); - $this->perhapsShowUp = true; - } - - if (!auth()->check() && !$mightAttendees->contains('anon_'.session()->getId().'|'.$this->name)) { - $mightAttendees->push('anon_'.session()->getId().'|'.$this->name); - $this->perhapsShowUp = true; - } - - $this->meetupEvent->update([ - 'might_attendees' => $mightAttendees->toArray(), - ]); - - $this->checkShowUp(); - } - - public function render() - { - return view('livewire.meetup.landing-page-event')->layout('layouts.guest', [ - 'SEOData' => new SEOData( - title: $this->meetupEvent->start->asDateTime().' - '.$this->meetup->name, - description: __('Here you can confirm your participation and find more information about the Meetup.').' - '.$this->meetupEvent->description, - image: $this->meetup->getFirstMediaUrl('logo'), - ), - ]); - } -} diff --git a/app/Http/Livewire/Meetup/MeetupEventTable.php b/app/Http/Livewire/Meetup/MeetupEventTable.php deleted file mode 100644 index d6ba6bea..00000000 --- a/app/Http/Livewire/Meetup/MeetupEventTable.php +++ /dev/null @@ -1,97 +0,0 @@ -year) { - $this->year = now()->year; - } - } - - public function render() - { - return view('livewire.meetup.meetup-event-table', [ - 'markers' => MeetupEvent::query() - ->with([ - 'meetup.city.country', - ]) - ->where('meetup_events.start', '>=', now()->subDay()) - ->whereHas('meetup.city.country', - fn($query) => $query->where('countries.code', $this->country->code)) - ->get() - ->map(fn($event) => [ - 'id' => $event->id, - 'name' => $event->meetup->name . ': ' . $event->location, - 'coords' => [$event->meetup->city->latitude, $event->meetup->city->longitude], - ]), - 'events' => MeetupEvent::query() - ->with([ - 'meetup.city.country', - ]) - ->where('meetup_events.start', '>=', now()->subDay()) - ->whereHas('meetup.city.country', - fn($query) => $query->where('countries.code', $this->country->code)) - ->get() - ->map(fn($event) => [ - 'id' => $event->id, - 'startDate' => $event->start, - 'endDate' => $event->start->addHours(1), - 'location' => $event->location, - 'description' => $event->description, - ]), - ])->layout('layouts.app', [ - 'SEOData' => new SEOData( - title: __('Meetup dates'), - description: __('List of all meetup dates'), - image: asset('img/screenshot.png') - ), - ]); - } - - public function filterByMarker($id) - { - return to_route('meetup.table.meetupEvent', [ - '#table', - 'country' => $this->country->code, - 'year' => $this->year, - 'meetup_events' => [ - 'filters' => [ - 'byid' => $id, - ], - ], - ]); - } - - public function popover($content, $ids) - { - return to_route('meetup.table.meetupEvent', [ - '#table', - 'year' => $this->year, - 'country' => $this->country->code, - 'meetup_events' => [ - 'filters' => [ - 'byid' => $ids, - ], - ], - ]); - } -} diff --git a/app/Http/Livewire/Meetup/MeetupTable.php b/app/Http/Livewire/Meetup/MeetupTable.php deleted file mode 100644 index bc6e8c1c..00000000 --- a/app/Http/Livewire/Meetup/MeetupTable.php +++ /dev/null @@ -1,54 +0,0 @@ -find($id); - - return to_route('meetup.landing', [ - 'country' => $meetup->city->country->code, - 'meetup' => $meetup, - ]); - } - - public function render() - { - // let markers = [{name: 'VAK', coords: [50.0091294, 9.0371812], status: 'closed', offsets: [0, 2]}]; - - return view('livewire.meetup.meetup-table', [ - 'markers' => Meetup::query() - ->where('visible_on_map', true) - ->with([ - 'city.country', - ]) - ->whereHas('city.country', - fn($query) => $query->where('countries.code', $this->country->code)) - ->get() - ->map(fn($meetup) => [ - 'id' => $meetup->id, - 'name' => $meetup->name, - 'coords' => [$meetup->city->latitude, $meetup->city->longitude], - ]), - ])->layout('layouts.app', [ - 'SEOData' => new SEOData( - title: __('Meetups'), - description: __('Bitcoiner Meetups are a great way to meet other Bitcoiners in your area. You can learn from each other, share ideas, and have fun!'), - image: asset('img/screenshot.png') - ), - ]); - } -} diff --git a/app/Http/Livewire/Meetup/WorldMap.php b/app/Http/Livewire/Meetup/WorldMap.php deleted file mode 100644 index 73637e53..00000000 --- a/app/Http/Livewire/Meetup/WorldMap.php +++ /dev/null @@ -1,46 +0,0 @@ -find($id); - - return to_route('meetup.landing', [ - 'country' => $meetup->city->country->code, - 'meetup' => $meetup, - ]); - } - - public function render() - { - return view('livewire.meetup.world-map', [ - 'allMarkers' => Meetup::query() - ->where('visible_on_map', true) - ->with([ - 'city.country', - ]) - ->get() - ->map(fn($meetup) => [ - 'id' => $meetup->id, - 'name' => $meetup->name, - 'coords' => [$meetup->city->latitude, $meetup->city->longitude], - ]), - ])->layout('layouts.app', [ - 'SEOData' => new SEOData( - title: __('World map of meetups'), - image: asset('img/screenshot.png') - ), - ]); - } -} diff --git a/app/Http/Livewire/News/ArticleOverview.php b/app/Http/Livewire/News/ArticleOverview.php deleted file mode 100644 index 1e9cc5d7..00000000 --- a/app/Http/Livewire/News/ArticleOverview.php +++ /dev/null @@ -1,103 +0,0 @@ - ['except' => ''], - ]; - - public function loadMore() - { - $this->perPage += 9; - } - - public function nostr($id) - { - $libraryItem = LibraryItem::query() - ->with([ - 'lecturer', - ]) - ->find($id); - $libraryItem->setStatus('published'); - $libraryItemName = $libraryItem->name; - if ($libraryItem->lecturer->nostr) { - $libraryItemName .= ' von @'.$libraryItem->lecturer->nostr; - } else { - $libraryItemName .= ' von '.$libraryItem->lecturer->name; - } - $text = sprintf("Ein neuer News-Artikel wurde verfasst:\n\n%s\n\n%s\n\n#Bitcoin #News #Einundzwanzig #gesundesgeld #einundzwanzig_portal_%s", - $libraryItemName, - url()->route('article.view', - ['libraryItem' => $libraryItem->slug]), - str($libraryItem->slug)->replace('-', '_') - ); - $result = $this->publishOnNostr($libraryItem, $text); - if ($result['success']) { - $this->notification() - ->success(title: __('Published on Nostr'), description: $result['output']); - } else { - $this->notification() - ->error(title: __('Failed'), - description: 'Exit Code: '.$result['exitCode'].' Reason: '.$result['errorOutput']); - } - } - - public function approve($id) - { - $libraryItem = LibraryItem::find($id); - $libraryItem->approved = true; - $libraryItem->save(); - - $this->notification() - ->success(__('Article approved')); - - $this->emit('$refresh'); - } - - public function resetFiltering() - { - return to_route('article.overview'); - } - - public function render() - { - return view('livewire.news.article-overview', [ - 'libraryItems' => LibraryItem::query() - ->with([ - 'createdBy.roles', - 'lecturer', - 'tags', - ]) - ->when( - isset($this->filters['author']), - fn($query) => $query->whereHas('lecturer', - fn($query) => $query->where('lecturers.slug', - $this->filters['author']))) - ->where('type', 'markdown_article') - ->where('news', true) - ->orderByDesc('created_at') - ->paginate($this->perPage), - ])->layout('layouts.app', [ - 'SEOData' => new SEOData( - title: __('News'), - description: __('Here we post important news that is relevant for everyone.'), - image: asset('img/einundzwanzig-news-colored.png'), - ), - ]); - } -} diff --git a/app/Http/Livewire/News/AuthorsOverview.php b/app/Http/Livewire/News/AuthorsOverview.php deleted file mode 100644 index beb74553..00000000 --- a/app/Http/Livewire/News/AuthorsOverview.php +++ /dev/null @@ -1,31 +0,0 @@ - Lecturer::query() - ->whereHas('libraryItems', function ($query) { - $query->where('library_items.news', true); - }) - ->withCount([ - 'libraryItems' => fn($query) => $query->where('library_items.news', true), - ]) - ->orderByDesc('library_items_count') - ->get(), - ])->layout('layouts.app', [ - 'SEOData' => new SEOData( - title: __('News articles writer'), - description: __('Click on any of the authors to see their articles.'), - image: asset('img/einundzwanzig-news-colored.png'), - ), - ]); - } -} diff --git a/app/Http/Livewire/News/Form/NewsArticleForm.php b/app/Http/Livewire/News/Form/NewsArticleForm.php deleted file mode 100644 index 2261bbc3..00000000 --- a/app/Http/Livewire/News/Form/NewsArticleForm.php +++ /dev/null @@ -1,134 +0,0 @@ - ['except' => ''], 'type' => ['except' => '']]; - - public function rules() - { - return [ - 'image' => [Rule::requiredIf(!$this->libraryItem->id), 'nullable', 'mimes:jpeg,png,jpg,gif', 'max:10240'], - - 'selectedTags' => 'array|min:1', - - 'libraryItem.lecturer_id' => 'required', - 'libraryItem.name' => 'required', - 'libraryItem.type' => 'required', - 'libraryItem.language_code' => 'required', - 'libraryItem.value' => 'required', - 'libraryItem.value_to_be_paid' => [Rule::requiredIf($this->libraryItem->sats > 0), 'nullable', 'string',], - 'libraryItem.sats' => [ - Rule::requiredIf($this->libraryItem->sats > 0), 'nullable', 'numeric', - ], - 'libraryItem.subtitle' => 'string|nullable', - 'libraryItem.excerpt' => 'required', - 'libraryItem.main_image_caption' => 'string|nullable', - 'libraryItem.read_time' => 'numeric|nullable', - 'libraryItem.approved' => 'boolean', - 'libraryItem.news' => 'boolean', - ]; - } - - public function mount() - { - if ($this->type === 'paid') { - $this->paid = true; - } - if (!$this->libraryItem) { - $this->libraryItem = new LibraryItem([ - 'type' => 'markdown_article', - 'value' => '', - 'value_to_be_paid' => '', - 'read_time' => 1, - 'sats' => $this->paid ? 21 : null, - 'news' => true, - 'language_code' => 'de', - 'approved' => false, - ]); - $this->selectedTags[] = 'News'; - } else { - $this->selectedTags = $this->libraryItem->tags() - ->where('type', 'library_item') - ->get() - ->map(fn($tag) => $tag->name) - ->toArray(); - } - if (!$this->fromUrl) { - $this->fromUrl = url()->previous(); - } - if (!$this->libraryItem->value_to_be_paid) { - $this->libraryItem->value_to_be_paid = ''; - } - } - - public function updatedImages($value) - { - $clonedImages = collect($this->imagesCloned); - $clonedImages = $clonedImages->push($value); - $this->imagesCloned = $clonedImages->toArray(); - - $temporaryUrls = collect($this->temporaryUrls); - $temporaryUrls = $temporaryUrls->push($value->temporaryUrl()); - $this->temporaryUrls = $temporaryUrls->toArray(); - } - - public function save() - { - $this->validate(); - $this->libraryItem->save(); - - $this->libraryItem->syncTagsWithType( - $this->selectedTags, - 'library_item' - ); - - if ($this->image) { - $this->libraryItem->addMedia($this->image) - ->usingFileName(md5($this->image->getClientOriginalName()).'.'.$this->image->getClientOriginalExtension()) - ->toMediaCollection('main'); - } - - return redirect($this->fromUrl); - } - - public function delete() - { - $this->libraryItem->delete(); - - return redirect($this->fromUrl); - } - - public function render() - { - return view('livewire.news.form.news-article-form'); - } -} diff --git a/app/Http/Livewire/News/InternArticleView.php b/app/Http/Livewire/News/InternArticleView.php deleted file mode 100644 index 4d9b17ce..00000000 --- a/app/Http/Livewire/News/InternArticleView.php +++ /dev/null @@ -1,142 +0,0 @@ -libraryItem->load([ - 'libraries', - ]); - if ($this->libraryItem->libraries->where('is_public', false) - ->count() > 0 && !auth()->check()) { - abort(403, __('Sorry! You are not authorized to perform this action.')); - } - if (auth()->check() && auth() - ->user() - ->paidArticles() - ->where('library_item_id', $this->libraryItem->id) - ->count() > 0) { - $this->invoicePaid = true; - } - if ($this->libraryItem->lecturer->paynym) { - $this->payNymQrCode = base64_encode(QrCode::format('png') - ->size(300) - ->merge($this->libraryItem->lecturer->getFirstMedia('avatar') - ? str( - $this->libraryItem - ->lecturer - ->getFirstMediaPath('avatar')) - ->replace('/home/einundzwanzig/portal.einundzwanzig.space', - '' - ) - : '/public/img/einundzwanzig.png', - .3) - ->errorCorrection('H') - ->generate($this->libraryItem->lecturer->paynym)); - } - } - - public function pay() - { - try { - $invoice = $this->createInvoice( - sats: $this->libraryItem->sats, - memo: 'Payment for: "'.$this->libraryItem->slug.'" on Einundzwanzig Portal.', - lnbits: $this->libraryItem->createdBy->lnbits, - ); - } catch (\Exception $e) { - $this->notification() - ->error('LNBits error: '.$e->getMessage()); - - return; - } - session('payment_hash_article_'.$this->libraryItem->id, $invoice['payment_hash']); - $this->paymentHash = $invoice['payment_hash']; - $this->qrCode = base64_encode(QrCode::format('png') - ->size(300) - ->merge($this->libraryItem->lecturer->getFirstMedia('avatar') - ? str( - $this->libraryItem - ->lecturer - ->getFirstMediaPath('avatar')) - ->replace('/home/einundzwanzig/portal.einundzwanzig.space', - '' - ) - : '/public/img/einundzwanzig.png', - .3) - ->errorCorrection('H') - ->generate($invoice['payment_request'])); - $this->invoice = $invoice['payment_request']; - $this->checkid = $invoice['checking_id']; - } - - public function checkPaymentHash() - { - try { - $invoice = $this->check($this->checkid ?? $this->checkThisPaymentHash, - $this->libraryItem->createdBy->lnbits); - } catch (\Exception $e) { - $this->notification() - ->error('LNBits error: '.$e->getMessage()); - - return; - } - if (isset($invoice['paid']) && $invoice['paid']) { - $this->invoicePaid = true; - if (auth()->check()) { - auth() - ->user() - ->paidArticles() - ->syncWithoutDetaching($this->libraryItem->id); - } - } else { - Log::error(json_encode($invoice, JSON_THROW_ON_ERROR)); - } - } - - public function render() - { - return view('livewire.news.intern-article-view')->layout('layouts.app', [ - 'SEOData' => new SEOData( - title: $this->libraryItem->name, - description: strip_tags($this->libraryItem->excerpt) ?? __('Here we post important news that is relevant for everyone.'), - author: $this->libraryItem->lecturer->name, - image: $this->libraryItem->getFirstMedia('main') - ? $this->libraryItem->getFirstMediaUrl('main', 'seo') - : url()->route('imgPublic', [ - 'path' => 'img/einundzwanzig-wallpaper-benrath.png', 'h' => 630, 'w' => 1200, 'fit' => 'crop' - ]), - published_time: Carbon::parse($this->libraryItem->created_at), - type: 'article', - ), - ]); - } -} diff --git a/app/Http/Livewire/Nostr/PlebsOverview.php b/app/Http/Livewire/Nostr/PlebsOverview.php deleted file mode 100644 index b499fb99..00000000 --- a/app/Http/Livewire/Nostr/PlebsOverview.php +++ /dev/null @@ -1,38 +0,0 @@ -plebsNpubs = User::query() - ->select([ - 'email', - 'public_key', - 'lightning_address', - 'lnurl', - 'node_id', - 'paynym', - 'lnbits', - 'nostr', - 'id', - ]) - ->whereNotNull('nostr') - ->orderByDesc('id') - ->get() - ->unique('nostr') - ->pluck('nostr') - ->toArray(); - } - - public function render() - { - return view('livewire.nostr.plebs-overview'); - } -} diff --git a/app/Http/Livewire/Nostr/Start.php b/app/Http/Livewire/Nostr/Start.php new file mode 100644 index 00000000..17e29348 --- /dev/null +++ b/app/Http/Livewire/Nostr/Start.php @@ -0,0 +1,13 @@ + 'https://legend.lnbits.com', - 'wallet_id' => '', - 'read_key' => '', - ]; - - public function rules() - { - return [ - 'settings.url' => 'required|url', - 'settings.wallet_id' => 'required', - 'settings.read_key' => 'required', - ]; - } - - public function mount() - { - if (auth()->user()->lnbits) { - $this->settings = auth()->user()->lnbits; - } - } - - public function save() - { - $this->validate(); - if ($this->checkLnbitsSettings($this->settings['read_key'], $this->settings['url'], $this->settings['wallet_id']) === false) { - $this->notification() - ->error(__('LNBits settings are not valid!')); - - return; - } - $user = auth()->user(); - $user->lnbits = $this->settings; - $user->save(); - - $this->notification() - ->success(__('LNBits settings saved successfully!')); - } - - public function render() - { - return view('livewire.profile.l-n-bits'); - } -} diff --git a/app/Http/Livewire/Profile/Meetups.php b/app/Http/Livewire/Profile/Meetups.php deleted file mode 100644 index 9ccf4456..00000000 --- a/app/Http/Livewire/Profile/Meetups.php +++ /dev/null @@ -1,135 +0,0 @@ - ['except' => '']]; - - public function rules() - { - return [ - 'search' => 'string', - ]; - } - - public function mount() - { - if (!auth()->user()) { - return to_route('auth.login'); - } - - $this->meetups = Meetup::query() - ->with([ - 'city', - ]) - ->where('name', 'ilike', '%'.$this->search.'%') - ->orderBy('name') - ->limit(10) - ->get(); - $this->myMeetups = auth() - ->user() - ->meetups() - ->pluck('meetup_id') - ->toArray(); - $this->myMeetupNames = auth() - ->user() - ->meetups() - ->with([ - 'city.country' - ]) - ->select('meetups.id', 'meetups.city_id', 'meetups.name', 'meetups.slug') - ->get() - ->map(fn($meetup) => [ - 'id' => $meetup->id, - 'name' => $meetup->name, - 'link' => route('meetup.landing', [ - 'country' => $meetup->city->country->code, - 'meetup' => $meetup, - ]) - ]) - ->toArray(); - if (count($this->myMeetups) > 0) { - $this->hasMeetups = true; - } - if (!$this->fromUrl) { - $this->fromUrl = url()->previous(); - } - } - - public function next() - { - return redirect($this->fromUrl); - } - - public function updatedSearch($value) - { - $this->meetups = Meetup::query() - ->with([ - 'city', - ]) - ->where('name', 'ilike', '%'.$value.'%') - ->orderBy('name') - ->limit(10) - ->get(); - } - - public function signUpForMeetup($id) - { - $user = auth()->user(); - $user->meetups() - ->toggle($id); - $this->myMeetups = auth() - ->user() - ->meetups() - ->pluck('meetup_id') - ->toArray(); - if (count($this->myMeetups) > 0) { - $this->hasMeetups = true; - } else { - $this->hasMeetups = false; - } - $this->myMeetupNames = auth() - ->user() - ->meetups() - ->with([ - 'city.country' - ]) - ->select('meetups.id', 'meetups.city_id', 'meetups.name', 'meetups.slug') - ->get() - ->map(fn($meetup) => [ - 'id' => $meetup->id, - 'name' => $meetup->name, - 'link' => route('meetup.landing', [ - 'country' => $meetup->city->country->code, - 'meetup' => $meetup, - ]) - ]) - ->toArray(); - $this->notification() - ->success(__('Saved.')); - } - - public function render() - { - return view('livewire.profile.meetups'); - } -} diff --git a/app/Http/Livewire/ProjectProposal/Form/ProjectProposalForm.php b/app/Http/Livewire/ProjectProposal/Form/ProjectProposalForm.php deleted file mode 100644 index 6014d063..00000000 --- a/app/Http/Livewire/ProjectProposal/Form/ProjectProposalForm.php +++ /dev/null @@ -1,73 +0,0 @@ - ['except' => ''], - ]; - - public function rules() - { - return [ - 'image' => [ - 'nullable', 'mimes:jpeg,png,jpg,gif', 'max:10240' - ], - - 'projectProposal.user_id' => 'required', - 'projectProposal.name' => 'required', - 'projectProposal.support_in_sats' => 'required|numeric', - 'projectProposal.description' => 'required', - ]; - } - - public function mount() - { - if (!$this->projectProposal) { - $this->projectProposal = new ProjectProposal([ - 'user_id' => auth()->id(), - 'description' => '', - ]); - } - if (!$this->fromUrl) { - $this->fromUrl = url()->previous(); - } - } - - public function save() - { - $this->validate(); - $this->projectProposal->save(); - - if ($this->image) { - $this->projectProposal->addMedia($this->image) - ->usingFileName(md5($this->image->getClientOriginalName()).'.'.$this->image->getClientOriginalExtension()) - ->toMediaCollection('main'); - } - - return redirect($this->fromUrl); - } - - public function render() - { - return view('livewire.project-proposal.form.project-proposal-form', [ - - ]); - } -} diff --git a/app/Http/Livewire/ProjectProposal/ProjectProposalTable.php b/app/Http/Livewire/ProjectProposal/ProjectProposalTable.php deleted file mode 100644 index 7426a22d..00000000 --- a/app/Http/Livewire/ProjectProposal/ProjectProposalTable.php +++ /dev/null @@ -1,23 +0,0 @@ -layout('layouts.app', [ - 'SEOData' => new SEOData( - title: __('Project Proposal'), - description: __('Submit a project proposal and let the community vote on it through the elected voters. All other community members can also vote.'), - image: asset('img/voting.jpg') - ), - ]); - } -} diff --git a/app/Http/Livewire/ProjectProposal/ProjectProposalVoting.php b/app/Http/Livewire/ProjectProposal/ProjectProposalVoting.php deleted file mode 100644 index 57c5b4ca..00000000 --- a/app/Http/Livewire/ProjectProposal/ProjectProposalVoting.php +++ /dev/null @@ -1,115 +0,0 @@ - ['except' => ''], - ]; - - public function rules() - { - return [ - 'vote.user_id' => 'required', - 'vote.project_proposal_id' => 'required', - 'vote.value' => 'required|boolean', - 'vote.reason' => [ - Rule::requiredIf(!$this->vote->value), - ] - ]; - } - - public function mount() - { - $this->projectProposal->load('votes'); - $vote = Vote::query() - ->where('user_id', auth()->id()) - ->where('project_proposal_id', $this->projectProposal->id) - ->first(); - if ($vote) { - $this->vote = $vote; - } else { - $this->vote = new Vote(); - $this->vote->user_id = auth()->id(); - $this->vote->project_proposal_id = $this->projectProposal->id; - $this->vote->value = false; - } - if (!$this->fromUrl) { - $this->fromUrl = url()->previous(); - } - } - - public function yes() - { - $this->vote->value = true; - $this->vote->save(); - - return to_route('voting.projectFunding', - ['projectProposal' => $this->projectProposal, 'fromUrl' => $this->fromUrl]); - } - - public function no() - { - $this->validate(); - - $this->vote->value = false; - $this->vote->save(); - - return to_route('voting.projectFunding', - ['projectProposal' => $this->projectProposal, 'fromUrl' => $this->fromUrl]); - } - - public function render() - { - return view('livewire.project-proposal.project-proposal-voting', [ - 'entitledVoters' => User::query() - ->with([ - 'votes' => fn($query) => $query->where('project_proposal_id', - $this->projectProposal->id) - ]) - ->withCount([ - 'votes' => fn($query) => $query->where('project_proposal_id', - $this->projectProposal->id) - ]) - ->whereHas('roles', function ($query) { - return $query->where('roles.name', 'entitled-voter'); - }) - ->orderByDesc('votes_count') - ->get(), - 'otherVoters' => User::query() - ->with([ - 'votes' => fn($query) => $query->where('project_proposal_id', - $this->projectProposal->id) - ]) - ->withCount([ - 'votes' => fn($query) => $query->where('project_proposal_id', - $this->projectProposal->id) - ]) - ->whereDoesntHave('roles', function ($query) { - return $query->where('roles.name', 'entitled-voter'); - }) - ->orderByDesc('votes_count') - ->get(), - ])->layout('layouts.app', [ - 'SEOData' => new SEOData( - title: __('Project Proposal'), - description: __('Submit a project proposal and let the community vote on it through the elected voters. All other community members can also vote.'), - image: asset('img/voting.jpg') - ), - ]); - } -} diff --git a/app/Http/Livewire/School/CityTable.php b/app/Http/Livewire/School/CityTable.php deleted file mode 100644 index 5e6ab2de..00000000 --- a/app/Http/Livewire/School/CityTable.php +++ /dev/null @@ -1,23 +0,0 @@ -layout('layouts.app', [ - 'SEOData' => new SEOData( - title: __('Courses'), - description: __('Choose your city, search for courses in the surrounding area and select a topic that suits you.'), - image: asset('img/screenshot.png') - ), - ]); - } -} diff --git a/app/Http/Livewire/School/CourseTable.php b/app/Http/Livewire/School/CourseTable.php deleted file mode 100644 index 2705e8a6..00000000 --- a/app/Http/Livewire/School/CourseTable.php +++ /dev/null @@ -1,23 +0,0 @@ -layout('layouts.app', [ - 'SEOData' => new SEOData( - title: __('Courses'), - description: __('Choose your city, search for courses in the surrounding area and select a topic that suits you.'), - image: asset('img/screenshot.png') - ), - ]); - } -} diff --git a/app/Http/Livewire/School/EventTable.php b/app/Http/Livewire/School/EventTable.php deleted file mode 100644 index 22be0b6e..00000000 --- a/app/Http/Livewire/School/EventTable.php +++ /dev/null @@ -1,94 +0,0 @@ -year) { - $this->year = now()->year; - } - } - - public function render() - { - return view('livewire.school.event-table', [ - 'markers' => CourseEvent::query() - ->with([ - 'course', - 'venue.city.country', - ]) - ->where('from', '>=', now()) - ->where(fn ($query) => $query - ->whereHas('venue.city.country', - fn ($query) => $query->where('countries.code', $this->country->code)) - ) - ->get() - ->map(fn ($event) => [ - 'id' => $event->id, - 'name' => $event->course->name, - 'coords' => [$event->venue->city->latitude, $event->venue->city->longitude], - ]), - 'events' => CourseEvent::query() - ->with([ - 'course', - 'venue.city.country', - ]) - ->where('from', '>=', now()) - ->get() - ->map(fn ($event) => [ - 'id' => $event->id, - 'startDate' => $event->from, - 'endDate' => $event->to, - 'location' => $event->course->name, - 'description' => $event->venue->name, - ]), - ])->layout('layouts.app', [ - 'SEOData' => new SEOData( - title: __('Dates'), - description: __('Dates for courses about Bitcoin.'), - image: asset('img/screenshot.png') - ), - ]); - } - - public function filterByMarker($id) - { - return to_route('school.table.event', [ - '#table', - 'country' => $this->country->code, - 'year' => $this->year, - 'course_events' => [ - 'filters' => [ - 'byid' => $id, - ], - ], - ]); - } - - public function popover($content, $ids) - { - return to_route('school.table.event', [ - '#table', - 'country' => $this->country->code, - 'year' => $this->year, - 'course_events' => [ - 'filters' => [ - 'byid' => $ids, - ], - ], - ]); - } -} diff --git a/app/Http/Livewire/School/Form/CourseEventForm.php b/app/Http/Livewire/School/Form/CourseEventForm.php deleted file mode 100644 index 57c5ac98..00000000 --- a/app/Http/Livewire/School/Form/CourseEventForm.php +++ /dev/null @@ -1,67 +0,0 @@ - [ - 'except' => null, - ], - ]; - - public function rules() - { - return [ - 'courseEvent.course_id' => 'required', - 'courseEvent.venue_id' => 'required', - 'courseEvent.from' => 'required', - 'courseEvent.to' => 'required', - 'courseEvent.link' => 'required', - ]; - } - - public function mount() - { - if (!$this->courseEvent) { - $this->courseEvent = new CourseEvent([]); - } elseif ( - !auth() - ->user() - ->can('update', $this->courseEvent) - ) { - abort(403); - } - if (!$this->fromUrl) { - $this->fromUrl = url()->previous(); - } - } - - public function submit() - { - $this->validate(); - $this->courseEvent->save(); - - return redirect($this->fromUrl); - } - - public function render() - { - return view('livewire.school.form.course-event-form'); - } -} diff --git a/app/Http/Livewire/School/Form/CourseForm.php b/app/Http/Livewire/School/Form/CourseForm.php deleted file mode 100644 index 3bd8118b..00000000 --- a/app/Http/Livewire/School/Form/CourseForm.php +++ /dev/null @@ -1,109 +0,0 @@ - [ - 'except' => null, - ], - ]; - - public function rules() - { - return [ - 'image' => [Rule::requiredIf(!$this->course->id), 'nullable', 'mimes:jpeg,png,jpg,gif', 'max:10240'], - - 'course.lecturer_id' => 'required', - 'course.name' => [ - 'required', - Rule::unique('courses', 'name') - ->ignore($this->course), - ], - 'course.description' => 'string|nullable', - ]; - } - - public function mount() - { - if (!$this->course) { - $this->course = new Course([ - 'description' => '', - ]); - } elseif ( - !auth() - ->user() - ->can('update', $this->course) - ) { - abort(403); - } else { - $this->selectedTags = $this->course->tags() - ->where('type', 'course') - ->get() - ->map(fn($tag) => $tag->name) - ->toArray(); - } - if (!$this->fromUrl) { - $this->fromUrl = url()->previous(); - } - } - - public function submit() - { - $this->validate(); - $this->course->save(); - - $this->course->syncTagsWithType( - $this->selectedTags, - 'course' - ); - - if ($this->image) { - $this->course->addMedia($this->image) - ->usingFileName(md5($this->image->getClientOriginalName()).'.'.$this->image->getClientOriginalExtension()) - ->toMediaCollection('logo'); - } - - return redirect($this->fromUrl); - } - - public function selectTag($name) - { - $selectedTags = collect($this->selectedTags); - if ($selectedTags->contains($name)) { - $selectedTags = $selectedTags->filter(fn($tag) => $tag !== $name); - } else { - $selectedTags->push($name); - } - $this->selectedTags = $selectedTags->values() - ->toArray(); - } - - public function render() - { - return view('livewire.school.form.course-form', [ - 'tags' => Tag::query() - ->where('type', 'course') - ->get(), - ]); - } -} diff --git a/app/Http/Livewire/School/LecturerLandingPage.php b/app/Http/Livewire/School/LecturerLandingPage.php deleted file mode 100644 index 5afbcf2a..00000000 --- a/app/Http/Livewire/School/LecturerLandingPage.php +++ /dev/null @@ -1,67 +0,0 @@ - CourseEvent::query() - ->with([ - 'venue.city', - 'course.tags', - ]) - ->where('from', '>=', now()) - ->whereHas('course', function ($query) { - $query->where('lecturer_id', $this->lecturer->id); - }) - ->orderBy('from') - ->get(), - 'events' => CourseEvent::query() - ->with([ - 'venue', - 'course', - ]) - ->where('from', '>=', now()) - ->whereHas('course', function ($query) { - $query->where('lecturer_id', $this->lecturer->id); - }) - ->orderBy('from') - ->get() - ->map(fn($event) => [ - 'id' => $event->id, - 'startDate' => $event->from, - 'endDate' => $event->to, - 'location' => $event->course->name, - 'description' => $event->venue->name, - ]), - ]) - ->layout('layouts.guest', [ - 'SEOData' => new SEOData( - title: $this->lecturer->name, - description: $this->lecturer->intro ?? __('This lecturer has not yet written an introduction.'), - image: $this->lecturer->getFirstMediaUrl('avatar'), - ), - ]); - } - - public function showEvent($id) - { - $this->activeEvent = $id; - } -} diff --git a/app/Http/Livewire/School/LecturerTable.php b/app/Http/Livewire/School/LecturerTable.php deleted file mode 100644 index caf31048..00000000 --- a/app/Http/Livewire/School/LecturerTable.php +++ /dev/null @@ -1,23 +0,0 @@ -layout('layouts.app', [ - 'SEOData' => new SEOData( - title: __('Lecturers'), - description: __('Lecturers in the surrounding area.'), - image: asset('img/screenshot.png') - ), - ]); - } -} diff --git a/app/Http/Livewire/School/SearchByTagComponent.php b/app/Http/Livewire/School/SearchByTagComponent.php deleted file mode 100644 index 5e1ce65e..00000000 --- a/app/Http/Livewire/School/SearchByTagComponent.php +++ /dev/null @@ -1,32 +0,0 @@ - Tag::query() - ->where('type', 'course') - ->with([ - 'courses.lecturer', - ]) - ->withCount([ - 'courses', - ]) - ->get(), - ]); - } -} diff --git a/app/Http/Livewire/School/VenueTable.php b/app/Http/Livewire/School/VenueTable.php deleted file mode 100644 index b98ba129..00000000 --- a/app/Http/Livewire/School/VenueTable.php +++ /dev/null @@ -1,27 +0,0 @@ - ['except' => false]]; - - public function render() - { - return view('livewire.school.venue-table')->layout('layouts.app', [ - 'SEOData' => new SEOData( - title: __('Venues'), - description: __('Venues in the surrounding area.'), - image: asset('img/screenshot.png') - ), - ]); - } -} diff --git a/app/Http/Livewire/Specials/BalticSeaCircle.php b/app/Http/Livewire/Specials/BalticSeaCircle.php deleted file mode 100644 index 2fe7537a..00000000 --- a/app/Http/Livewire/Specials/BalticSeaCircle.php +++ /dev/null @@ -1,21 +0,0 @@ -layout('layouts.guest', [ - 'SEOData' => new SEOData( - title: 'Baltic Sea Circle Rally Bitcoin Team 218', - description: 'Besucht das Bitcoin Team 218 von Daktari und Cercatrova zum Start der diesjährigen Baltic Sea Circle Rally', - image: asset('img/bsc/3.jpg'), - ), - ]); - } -} diff --git a/app/Http/Livewire/Tables/BitcoinEventTable.php b/app/Http/Livewire/Tables/BitcoinEventTable.php deleted file mode 100644 index 7459c845..00000000 --- a/app/Http/Livewire/Tables/BitcoinEventTable.php +++ /dev/null @@ -1,107 +0,0 @@ -setPrimaryKey('id') - ->setDefaultSort('from', 'asc') - ->setAdditionalSelects([ - 'bitcoin_events.id', - 'bitcoin_events.venue_id', - 'bitcoin_events.created_by', - ]) - ->setThAttributes(function (Column $column) { - return [ - 'class' => 'px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider dark:bg-gray-800 dark:text-gray-400', - 'default' => false, - ]; - }) - ->setTdAttributes(function (Column $column, $row, $columnIndex, $rowIndex) { - return [ - 'class' => 'px-6 py-4 text-sm font-medium dark:text-white', - 'default' => false, - ]; - }) - ->setColumnSelectStatus(false) - ->setPerPage(10) - ->setConfigurableAreas([ - 'toolbar-left-end' => [ - 'columns.bitcoin_events.areas.toolbar-left-end', [ - 'country' => $this->country, - ], - ], - ]); - } - - public function filters(): array - { - return [ - TextFilter::make('Event by ID', 'byid') - ->hiddenFromMenus() - ->filter(function (Builder $builder, string $value) { - $builder->whereIn('bitcoin_events.id', str($value)->explode(',')); - }), - ]; - } - - public function columns(): array - { - return [ - Column::make(__('Country'), 'venue.city.country.name') - ->format( - fn ($value, $row, Column $column) => view('columns.bitcoin_events.country')->withRow($row) - ) - ->sortable() - ->collapseOnMobile(), - Column::make(__('Title'), 'title') - ->format( - fn ($value, $row, Column $column) => view('columns.bitcoin_events.title')->withRow($row) - ) - ->sortable(), - Column::make(__('From'), 'from') - ->format( - fn ($value, $row, Column $column) => $value->asDateTime() - ), - Column::make(__('To'), 'to') - ->format( - fn ($value, $row, Column $column) => $value->asDateTime() - ) - ->collapseOnMobile(), - Column::make(__('Venue'), 'venue.name') - ->collapseOnMobile(), - Column::make(__('Link'), 'link') - ->format( - fn ($value, $row, Column $column) => view('columns.bitcoin_events.link')->withRow($row) - ) - ->sortable() - ->collapseOnMobile(), - ]; - } - - public function builder(): Builder - { - return BitcoinEvent::query() - ->with([ - 'venue.city.country', - ]) - ->where('bitcoin_events.from', '>=', now()) - ->where(fn ($query) => $query - ->whereHas('venue.city.country', - fn ($query) => $query->where('code', $this->country)) - ->orWhere('show_worldwide', true) - ); - } -} diff --git a/app/Http/Livewire/Tables/BookCaseTable.php b/app/Http/Livewire/Tables/BookCaseTable.php deleted file mode 100644 index 9a18301c..00000000 --- a/app/Http/Livewire/Tables/BookCaseTable.php +++ /dev/null @@ -1,122 +0,0 @@ -setPrimaryKey('id') - ->setAdditionalSelects(['id', 'homepage']) - ->setThAttributes(function (Column $column) { - return [ - 'class' => 'px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider dark:bg-gray-800 dark:text-gray-400', - 'default' => false, - ]; - }) - ->setTdAttributes(function (Column $column, $row, $columnIndex, $rowIndex) { - return [ - 'class' => 'px-6 py-4 text-sm font-medium dark:text-white', - 'default' => false, - ]; - }) - ->setColumnSelectStatus(false) - ->setPerPage(10); - } - - public function filters(): array - { - return [ - TextFilter::make('By IDs', 'byids') - ->hiddenFromMenus() - ->filter(function (Builder $builder, string $value) { - $builder->whereIn('id', str($value)->explode(',')); - }), - ]; - } - - public function columns(): array - { - return [ - Column::make('Name', 'title') - ->sortable() - ->searchable( - function (Builder $query, $searchTerm) { - $query->where('title', 'ilike', '%'.$searchTerm.'%'); - } - ), - Column::make('Adresse', 'address') - ->sortable() - ->searchable(), - Column::make('Bitcoin-Bücher') - ->label( - fn ( - $row, - Column $column - ) => $row->orangePills->sum('amount') - ) - ->collapseOnMobile(), - Column::make('Letzter Input') - ->label( - fn ( - $row, - Column $column - ) => $row->orangePills() - ->latest() - ->first()?->date->asDate() - ) - ->collapseOnMobile(), - Column::make('Link') - ->label( - fn ( - $row, - Column $column - ) => $row->homepage ? 'Link' : null - ) - ->html() - ->collapseOnMobile(), - Column::make('Orange-Pilled', 'orange_pilled') - ->label(fn ($row, Column $column) => view('columns.book_cases.oranged-pilled') - ->withRow($row) - ->withCountry($this->country)) - ->collapseOnMobile(), - ]; - } - - private function url_to_absolute($url) - { - if (str($url)->contains('http')) { - return $url; - } - if (! str($url)->contains('http')) { - return str($url)->prepend('https://'); - } - } - - public function builder(): Builder - { - return BookCase::query() - ->active() - ->with([ - 'orangePills', - ]) - ->withCount([ - 'orangePills', - ]) - ->orderByDesc('orange_pills_count') - ->orderBy('book_cases.id'); - } -} diff --git a/app/Http/Livewire/Tables/CityTable.php b/app/Http/Livewire/Tables/CityTable.php deleted file mode 100644 index f7d6dd43..00000000 --- a/app/Http/Livewire/Tables/CityTable.php +++ /dev/null @@ -1,140 +0,0 @@ -setPrimaryKey('id') - ->setAdditionalSelects(['cities.id', 'cities.created_by']) - ->setThAttributes(function (Column $column) { - return [ - 'class' => 'px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider dark:bg-gray-800 dark:text-gray-400', - 'default' => false, - ]; - }) - ->setTdAttributes(function (Column $column, $row, $columnIndex, $rowIndex) { - return [ - 'class' => 'px-6 py-4 text-sm font-medium dark:text-white', - 'default' => false, - ]; - }) - ->setColumnSelectStatus(false) - ->setPerPage(10) - ->setConfigurableAreas([ - 'toolbar-left-end' => [ - 'columns.cities.areas.toolbar-left-end', [ - 'country' => $this->country, - ], - ], - ]); - } - - public function columns(): array - { - $columns = collect([ - Column::make('Stadt Name', 'name') - ->sortable() - ->searchable(fn ($builder, $term) => $builder->where('cities.name', 'ilike', '%'.$term.'%')), - ]); - if ($this->type === 'school') { - $columns = $columns->merge([ - Column::make('Veranstaltungs-Orte') - ->label( - fn ($row, Column $column) => $row->venues_count - ) - ->collapseOnMobile(), - Column::make('Termine') - ->label( - fn ($row, Column $column) => $row->course_events_count - ) - ->collapseOnMobile(), - ]); - } - - return $columns->merge([ - Column::make('') - ->label( - fn ($row, Column $column) => view('columns.cities.action') - ->withRow($row) - ->withType($this->type) - ->withManage($this->manage) - ), - ]) - ->toArray(); - } - - public function builder(): Builder - { - return City::query() - ->withCount([ - 'venues', - 'courseEvents', - ]) - ->whereHas('country', fn ($query) => $query->where('code', $this->country)) - ->orderByDesc('course_events_count') - ->orderBy('cities.id'); - } - - public function proximitySearch($id) - { - $city = City::query() - ->find($id); - $query = City::radius($city->latitude, $city->longitude, 100) - ->where('id', '!=', $id); - - return to_route('school.table.event', [ - '#table', - 'country' => $this->country, - 'course_events' => [ - 'filters' => [ - 'stadt' => $query->pluck('name') - ->push($city->name) - ->implode(','), - ], - ], - ]); - } - - public function proximitySearchForBookCases($id) - { - $city = City::query() - ->find($id); - $query = BookCase::active()->radius($city->latitude, $city->longitude, 25); - $ids = $query->pluck('id'); - if ($ids->isEmpty()) { - $this->notification() - ->error(__('No bookcases found in the radius of 5km')); - - return; - } - - return to_route('bookCases.table.bookcases', [ - '#table', - 'country' => $this->country, - 'bookcases' => [ - 'filters' => [ - 'byids' => $ids->implode(','), - ], - ], - ]); - } -} diff --git a/app/Http/Livewire/Tables/CourseTable.php b/app/Http/Livewire/Tables/CourseTable.php deleted file mode 100644 index 39b07a74..00000000 --- a/app/Http/Livewire/Tables/CourseTable.php +++ /dev/null @@ -1,122 +0,0 @@ -setPrimaryKey('id') - ->setAdditionalSelects(['courses.id', 'courses.created_by']) - ->setThAttributes(function (Column $column) { - return [ - 'class' => 'px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider dark:bg-gray-800 dark:text-gray-400', - 'default' => false, - ]; - }) - ->setTdAttributes(function (Column $column, $row, $columnIndex, $rowIndex) { - return [ - 'class' => 'px-6 py-4 text-sm font-medium dark:text-white', - 'default' => false, - ]; - }) - ->setColumnSelectStatus(false) - ->setPerPage(10) - ->setConfigurableAreas([ - 'toolbar-left-end' => [ - 'columns.courses.areas.toolbar-left-end', [ - 'country' => $this->country, - ], - ], - ]); - } - - public function filters(): array - { - return [ - MultiSelectFilter::make('Tag') - ->options( - Tag::query() - ->withType('course') - ->get() - ->mapWithKeys(fn ($item, $key) => [$item->name => $item->name]) - ->toArray() - ) - ->filter(function (Builder $builder, array $values) { - $builder->withAnyTags($values, 'course'); - }), - ]; - } - - public function columns(): array - { - return [ - Column::make('Dozent', 'lecturer.name') - ->label( - fn ($row, Column $column) => view('columns.courses.lecturer')->withRow($row) - ) - ->sortable() - ->collapseOnMobile(), - Column::make('Name', 'name') - ->searchable(fn (Builder $query, string $term) => $query->where('name', 'ilike', '%'.$term.'%')) - ->sortable(), - Column::make('Tags') - ->label( - fn ($row, Column $column) => view('columns.courses.tags')->withRow($row) - ) - ->collapseOnMobile(), - Column::make('Termine') - ->label( - fn ($row, Column $column) => ''.$row->course_events_count.'' - ) - ->html() - ->sortable() - ->collapseOnMobile(), - Column::make('Erstellt am', 'created_at') - ->sortable() - ->collapseOnMobile(), - Column::make('') - ->label( - fn ($row, Column $column) => view('columns.courses.action')->withRow($row) - ), - ]; - } - - public function builder(): Builder - { - return Course::query() - ->with([ - 'lecturer', - 'tags', - ]) - ->withCount([ - 'courseEvents' => fn($query) => $query->where('course_events.from', '>', now()), - ]) - ->orderByDesc('course_events_count') - ->orderBy('courses.id'); - } - - public function courseSearch($id) - { - return to_route('school.table.event', [ - '#table', - 'country' => $this->country, - 'course_events' => [ - 'filters' => [ - 'course_id' => $id, - ], - ], - ]); - } -} diff --git a/app/Http/Livewire/Tables/EventTable.php b/app/Http/Livewire/Tables/EventTable.php deleted file mode 100644 index f5a3c9ad..00000000 --- a/app/Http/Livewire/Tables/EventTable.php +++ /dev/null @@ -1,202 +0,0 @@ -setPrimaryKey('id') - ->setDefaultSort('from', 'asc') - ->setAdditionalSelects([ - 'course_events.id', - 'course_events.created_by', - 'course_id', - 'venue_id', - ]) - ->setThAttributes(function (Column $column) { - return [ - 'class' => 'px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider dark:bg-gray-800 dark:text-gray-400', - 'default' => false, - ]; - }) - ->setTdAttributes(function (Column $column, $row, $columnIndex, $rowIndex) { - return [ - 'class' => 'px-6 py-4 text-sm font-medium dark:text-white', - 'default' => false, - ]; - }) - ->setColumnSelectStatus(false) - ->setPerPage(10) - ->setConfigurableAreas([ - 'toolbar-left-end' => [ - 'columns.course-events.areas.toolbar-left-end', [ - 'country' => $this->country, - ], - ], - ]); - } - - public function filters(): array - { - return [ - TextFilter::make('Event by ID', 'byid') - ->hiddenFromMenus() - ->filter(function (Builder $builder, string $value) { - $builder->whereIn('course_events.id', str($value)->explode(',')); - }), - TextFilter::make(__('City')) - ->config([ - 'placeholder' => __('Search City'), - ]) - ->filter(function (Builder $builder, string $value) { - if (str($value)->contains(',')) { - $builder - ->whereHas('venue.city', - function ($query) use ($value) { - $query->whereIn('cities.name', str($value)->explode(',')); - }); - } else { - $builder->whereHas('venue.city', - fn ($query) => $query->where('cities.name', 'ilike', "%$value%")); - } - }), - TextFilter::make(__('Venue'), 'venue') - ->config([ - 'placeholder' => __('Search Venue'), - ]) - ->filter(function (Builder $builder, string $value) { - $builder->whereHas('venue', - fn ($query) => $query->where('venues.name', 'ilike', "%$value%")); - }), - TextFilter::make(__('Course')) - ->config([ - 'placeholder' => __('Search Course'), - ]) - ->filter(function (Builder $builder, string $value) { - $builder->whereHas('course', - fn ($query) => $query->where('courses.name', 'ilike', "%$value%")); - }), - TextFilter::make('Course by ID', 'course_id') - ->hiddenFromMenus() - ->filter(function (Builder $builder, string $value) { - $builder->whereHas('course', - fn ($query) => $query->where('courses.id', '=', $value)); - }), - MultiSelectFilter::make(__('Type')) - ->options( - Category::query() - ->pluck('name', 'id') - ->toArray() - ) - ->filter(function (Builder $builder, array $values) { - $builder->whereHas('course.categories', - fn ($query) => $query->whereIn('categories.id', $values)); - }), - SelectFilter::make(__('Lecturer')) - ->options( - Lecturer::query() - ->pluck('name', 'id') - ->toArray() - ) - ->filter(function (Builder $builder, string $value) { - $builder->whereHas('course.lecturer', - fn ($query) => $query->where('lecturers.id', $value)); - }), - ]; - } - - public function columns(): array - { - return [ - Column::make(_('City'), 'venue.city.name') - ->sortable() - ->collapseOnMobile(), - Column::make(__('Venue'), 'venue.name') - ->sortable() - ->collapseOnMobile(), - Column::make(__('Lecturer'), 'course.lecturer.name') - ->label( - fn ($row, Column $column) => view('columns.events.lecturer')->withRow($row) - ) - ->sortable() - ->collapseOnMobile(), - Column::make(__('Course'), 'course.name') - ->sortable(), - Column::make(__('Type')) - ->label( - fn ($row, Column $column) => view('columns.events.categories')->withRow($row) - ) - ->collapseOnMobile(), - Column::make(__('From'), 'from') - ->format( - fn ($value, $row, Column $column) => $value->asDateTime() - ) - ->sortable(), - Column::make(__('To'), 'to') - ->format( - fn ($value, $row, Column $column) => $value->asDateTime() - ) - ->sortable() - ->collapseOnMobile(), - /*Column::make("Teilnehmer") - ->label( - fn($row, Column $column) => ''.$row->registrations->count().'' - ) - ->html() - ->sortable(),*/ - Column::make(__('Actions')) - ->label( - fn ($row, Column $column) => view('columns.events.action')->withRow($row) - ) - ->collapseOnMobile(), - ]; - } - - public function builder(): Builder - { - return CourseEvent::query() - ->with([ - 'course.lecturer', - 'course.categories', - ]) - ->where('from', '>=', now()) - ->whereHas('venue.city.country', - fn ($query) => $query->where('countries.code', $this->country)); - } - - public function viewHistoryModal($modelId): void - { - $this->viewingModal = true; - $this->currentModal = CourseEvent::findOrFail($modelId); - } - - public function resetModal(): void - { - $this->reset('viewingModal', 'currentModal'); - } - - public function customView(): string - { - return 'modals.events.register'; - } -} diff --git a/app/Http/Livewire/Tables/LecturerTable.php b/app/Http/Livewire/Tables/LecturerTable.php deleted file mode 100644 index bbfcff2e..00000000 --- a/app/Http/Livewire/Tables/LecturerTable.php +++ /dev/null @@ -1,118 +0,0 @@ -setPrimaryKey('id') - ->setAdditionalSelects(['id']) - ->setThAttributes(function (Column $column) { - return [ - 'class' => 'px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider dark:bg-gray-800 dark:text-gray-400', - 'default' => false, - ]; - }) - ->setTdAttributes(function (Column $column, $row, $columnIndex, $rowIndex) { - return [ - 'class' => 'px-6 py-4 text-sm font-medium dark:text-white', - 'default' => false, - ]; - }) - ->setColumnSelectStatus(false) - ->setPerPage(10) - ->setConfigurableAreas([ - 'toolbar-left-end' => [ - 'columns.lectures.areas.toolbar-left-end', [ - 'country' => $this->country, - ], - ], - ]); - } - - public function columns(): array - { - return [ - ImageColumn::make('Bild') - ->location( - fn ($row) => $row->getFirstMediaUrl('avatar', 'thumb') - ) - ->attributes(fn ($row) => [ - 'class' => 'rounded h-16 w-16', - 'alt' => $row->name.' Avatar', - ]) - ->collapseOnMobile(), - Column::make('Name', 'name') - ->searchable(fn ($query, $term) => $query->where('name', 'ilike', '%'.$term.'%')) - ->sortable(), - BooleanColumn::make('Aktiv', 'active') - ->sortable() - ->collapseOnMobile(), - Column::make('Kurse') - ->label( - fn ($row, Column $column) => $row->courses_count - ) - ->collapseOnMobile(), - Column::make('Inhalte') - ->label( - fn ($row, Column $column) => $row->library_items_count - ) - ->collapseOnMobile(), - Column::make('') - ->label( - fn ($row, Column $column) => view('columns.lectures.action') - ->withRow($row) - ->withCountry($this->country) - ), - - ]; - } - - public function builder(): Builder - { - return Lecturer::query() - ->withCount([ - 'courses', - 'coursesEvents', - 'libraryItems' => fn($query) => $query->where('news', false) - ]); - } - - public function lecturerSearch($id, $event = true) - { - $lecturer = Lecturer::query() - ->find($id); - - if ($event) { - return to_route('school.table.event', [ - '#table', - 'country' => $this->country, - 'course_events' => [ - 'filters' => [ - 'dozent' => $lecturer->id, - ], - ], - ]); - } else { - return to_route('library.table.libraryItems', [ - '#table', - 'country' => $this->country, - 'filters' => [ - 'lecturer_id' => $lecturer->id, - ], - ]); - } - } -} diff --git a/app/Http/Livewire/Tables/LibraryItemTable.php b/app/Http/Livewire/Tables/LibraryItemTable.php deleted file mode 100644 index 8499bbe4..00000000 --- a/app/Http/Livewire/Tables/LibraryItemTable.php +++ /dev/null @@ -1,187 +0,0 @@ -setPrimaryKey('id') - ->setAdditionalSelects(['id']) - ->setDefaultSort('order_column', 'asc') - ->setThAttributes(function (Column $column) { - return [ - 'class' => 'px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider dark:bg-gray-800 dark:text-gray-400', - 'default' => false, - ]; - }) - ->setTdAttributes(function (Column $column, $row, $columnIndex, $rowIndex) { - return [ - 'class' => 'px-6 py-4 text-sm font-medium dark:text-white', - 'default' => false, - ]; - }) - ->setColumnSelectStatus(false) - ->setPerPage(10); - } - - public function filters(): array - { - return [ - TextFilter::make(__('By id'), 'id') - ->hiddenFromMenus() - ->filter(function (Builder $builder, string $value) { - $builder->where('library_items.id', '=', $value); - }), - TextFilter::make(__('By lecturer'), 'lecturer_id') - ->hiddenFromMenus() - ->filter(function (Builder $builder, string $value) { - $builder->where('library_items.lecturer_id', '=', $value); - }), - MultiSelectFilter::make('Tag') - ->options( - Tag::query() - ->where('type', 'library_item') - ->get() - ->pluck('name', 'id') - ->toArray() - ) - ->filter(function (Builder $builder, array $values) { - $builder->whereHas('tags', function (Builder $query) use ($values) { - $query->whereIn('tags.id', $values); - }); - }), - SelectFilter::make('Bibliothek') - ->options( - Library::query() - ->where('is_public', true) - ->get() - ->prepend(new Library(['name' => '*'])) - ->pluck('name', 'name') - ->toArray(), - ) - ->filter(function (Builder $builder, string $value) { - if ($value === '*') { - return; - } - if (str($value)->contains(',')) { - $builder - ->whereHas('libraries', - function ($query) use ($value) { - $query->whereIn('libraries.name', str($value)->explode(',')); - }); - } else { - $builder->whereHas('libraries', - fn ($query) => $query->where('libraries.name', 'ilike', "%$value%")); - } - }), - SelectFilter::make('Art') - ->options( - collect( - Options::forEnum(LibraryItemType::class) - ->toArray() - ) - ->mapWithKeys(fn ($value, $key) => [$value['value'] => $value['label']]) - ->prepend('*', '') - ->toArray() - ) - ->filter(function (Builder $builder, string $value) { - if ($value === '*') { - return; - } - $builder->where('library_items.type', $value); - }), - ]; - } - - public function columns(): array - { - return [ - Column::make(__('Image')) - ->label( - fn ($row, Column $column) => view('columns.library_items.image')->withRow($row) - ) - ->collapseOnMobile(), - Column::make(__('Creator'), 'lecturer.name') - ->label( - fn ($row, Column $column) => view('columns.courses.lecturer')->withRow($row) - ) - ->sortable() - ->collapseOnMobile(), - Column::make('Name', 'name') - ->sortable(), - Column::make('Art', 'type') - ->format( - function ($value, $row, Column $column) { - return '' - .LibraryItemType::labels()[$value] - .''; - }) - ->html() - ->sortable() - ->collapseOnMobile(), - Column::make('Tags') - ->label( - fn ($row, Column $column) => view('columns.library_items.tags')->withRow($row) - ) - ->collapseOnMobile(), - Column::make('') - ->label( - fn ($row, Column $column) => view('columns.library_items.action')->withRow($row) - ), - ]; - } - - public function builder(): Builder - { - $shouldBePublic = request() - ?->route() - ?->getName() !== 'library.table.lecturer'; - - if ($this->currentTab !== '*') { - $parentLibrary = Library::query() - ->where('name', $this->currentTab) - ->first(); - } - - return LibraryItem::query() - ->with([ - 'lecturer', - 'tags', - ]) - ->whereHas('libraries', fn ($query) => $query->where('libraries.is_public', $shouldBePublic)) - ->when($this->currentTab !== '*', fn ($query) => $query - ->whereHas('libraries', - fn ($query) => $query - ->where('libraries.name', $this->currentTab) - ) - ->orWhereHas('libraries', - fn ($query) => $query - ->where('libraries.parent_id', $parentLibrary->id) - ) - ) - ->withCount([ - 'lecturer', - ]) - ->currentStatus('published'); - } -} diff --git a/app/Http/Livewire/Tables/MeetupEventTable.php b/app/Http/Livewire/Tables/MeetupEventTable.php deleted file mode 100644 index 5eaba3e4..00000000 --- a/app/Http/Livewire/Tables/MeetupEventTable.php +++ /dev/null @@ -1,117 +0,0 @@ -setPrimaryKey('id') - ->setAdditionalSelects(['meetup_events.id', 'meetup_events.meetup_id', 'attendees', 'might_attendees']) - ->setDefaultSort('start', 'asc') - ->setThAttributes(function (Column $column) { - return [ - 'class' => 'px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider dark:bg-gray-800 dark:text-gray-400', - 'default' => false, - ]; - }) - ->setTdAttributes(function (Column $column, $row, $columnIndex, $rowIndex) { - return [ - 'class' => 'px-6 py-4 text-sm font-medium dark:text-white', - 'default' => false, - ]; - }) - ->setColumnSelectStatus(false) - ->setPerPage(10) - ->setConfigurableAreas([ - 'toolbar-left-end' => [ - 'columns.meetup_events.areas.toolbar-left-end', [ - 'country' => $this->country, - ], - ], - ]); - } - - public function filters(): array - { - return [ - TextFilter::make('Meetup-Event by ID', 'bymeetupid') - ->hiddenFromMenus() - ->filter(function (Builder $builder, string $value) { - $builder->whereIn('meetup_events.meetup_id', str($value)->explode(',')); - }), - TextFilter::make('Meetup-Event by ID', 'byid') - ->hiddenFromMenus() - ->filter(function (Builder $builder, string $value) { - $builder->whereIn('meetup_events.id', str($value)->explode(',')); - }), - ]; - } - - public function columns(): array - { - $columns = [ - Column::make(__('Meetup'), 'meetup.name') - ->format( - fn ($value, $row, Column $column) => view('columns.meetup_events.name') - ->withRow($row) - ->withCountry($this->country) - ) - ->searchable(fn ($builder, $term) => $builder->where('meetups.name', 'ilike', '%'.$term.'%')) - ->sortable(), - Column::make(__('Location'), 'location') - ->searchable(fn ($builder, $term) => $builder->where('location', 'ilike', '%'.$term.'%')) - ->sortable() - ->collapseOnMobile(), - Column::make(__('Start'), 'start') - ->format( - fn ($value, $row, Column $column) => $value->asDateTime() - ) - ->sortable() - ->collapseOnMobile(), - Column::make(__('Confirmations')) - ->label( - fn ($row, Column $column) => view('columns.meetup_events.confirmations') - ->withRow($row) - ) - ->collapseOnMobile(), - Column::make(__('Link')) - ->label( - fn ($row, Column $column) => view('columns.meetup_events.link') - ->withRow($row) - ) - ->collapseOnMobile(), - ]; - - $adminColumns = auth()->check() ? [ - Column::make(__('Actions')) - ->label( - fn ($row, Column $column) => view('columns.meetup_events.manage') - ->withRow($row) - ) - ->collapseOnMobile(), - ] : []; - - return array_merge($columns, $adminColumns); - } - - public function builder(): Builder - { - return MeetupEvent::query() - ->where('meetup_events.start', '>=', now()->subDay()) - ->whereHas('meetup.city.country', fn ($query) => $query->where('code', $this->country)) - ->with([ - 'meetup.city.country', - ]); - } -} diff --git a/app/Http/Livewire/Tables/MeetupForBtcMapTable.php b/app/Http/Livewire/Tables/MeetupForBtcMapTable.php deleted file mode 100644 index b4349b0f..00000000 --- a/app/Http/Livewire/Tables/MeetupForBtcMapTable.php +++ /dev/null @@ -1,54 +0,0 @@ -setPrimaryKey('id') - ->setAdditionalSelects([ - 'osm_relation', - 'simplified_geojson', - 'population', - 'population_date', - 'city_id', - ]) - ->setPerPageAccepted([ - 100000, - ]) - ->setPerPage(100000); - } - - public function columns(): array - { - return [ - Column::make('Id', 'id') - ->sortable(), - Column::make('Name', 'name') - ->sortable(), - Column::make('City', 'city.name') - ->sortable(), - Column::make('Country', 'city.country.name') - ->sortable(), - Column::make('Actions') - ->label(fn($row, Column $column) => view('columns.meetups.osm-actions', ['row' => $row])), - ]; - } - - public function builder(): Builder - { - return Meetup::query() - ->with([ - 'city.country', - ]) - ->where('community', '=', 'einundzwanzig') - ->orderBy('cities.population'); - } -} diff --git a/app/Http/Livewire/Tables/MeetupTable.php b/app/Http/Livewire/Tables/MeetupTable.php deleted file mode 100644 index 03e23013..00000000 --- a/app/Http/Livewire/Tables/MeetupTable.php +++ /dev/null @@ -1,112 +0,0 @@ -setPrimaryKey('id') - ->setAdditionalSelects(['meetups.id', 'meetups.slug', 'meetups.created_by']) - ->setThAttributes(function (Column $column) { - return [ - 'class' => 'px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider dark:bg-gray-800 dark:text-gray-400', - 'default' => false, - ]; - }) - ->setTdAttributes(function (Column $column, $row, $columnIndex, $rowIndex) { - return [ - 'class' => 'px-6 py-4 text-sm font-medium dark:text-white', - 'default' => false, - ]; - }) - ->setColumnSelectStatus(false) - ->setPerPage(10) - ->setConfigurableAreas([ - 'toolbar-left-end' => [ - 'columns.meetups.areas.toolbar-left-end', [ - 'country' => $this->country, - ], - ], - ]); - } - - public function filters(): array - { - return [ - TextFilter::make('Meetup by ID', 'byid') - ->hiddenFromMenus() - ->filter(function (Builder $builder, string $value) { - $builder->whereIn('meetups.id', str($value)->explode(',')); - }), - ]; - } - - public function columns(): array - { - return [ - Column::make(__('Name'), 'name') - ->format( - fn ($value, $row, Column $column) => view('columns.meetups.name') - ->withRow($row) - ) - ->searchable(fn ($builder, $term) => $builder->where('meetups.name', 'ilike', '%'.$term.'%')), - Column::make(__('Plebs')) - ->label(fn ($row, Column $column) => $row->users_count) - ->collapseOnMobile(), - Column::make(__('Links')) - ->label( - fn ($row, Column $column) => view('columns.meetups.action') - ->withRow($row) - ->withIcs(route('meetup.ics', - ['country' => $this->country ?? $row->city->country->code, 'meetup' => $row->id])) - ->withCountry($this->country) - ) - ->collapseOnMobile(), - ]; - } - - public function builder(): Builder - { - return Meetup::query() - ->with([ - 'users', - 'city.country', - 'meetupEvents', - ]) - ->when($this->country, - fn ($query, $country) => $query->whereRelation('city.country', 'code', $this->country)) - ->withCount([ - 'users', - 'meetupEvents' => fn ($query) => $query->where('start', '>=', - now()), - ]) - ->when(! $this->country, fn ($query) => $query->orderByDesc('users_count') - ->orderBy('meetups.id')) - ->when($this->country, fn ($query) => $query->orderByDesc('meetup_events_count') - ->orderBy('meetups.id')); - } - - public function meetupEventSearch($id) - { - $meetup = Meetup::with(['city.country']) - ->find($id); - - return to_route('meetup.table.meetupEvent', [ - 'country' => $this->country ?? $meetup->city->country->code, - 'meetup_events' => [ - 'filters' => ['bymeetupid' => $id], - ], - ]); - } -} diff --git a/app/Http/Livewire/Tables/ProjectProposalTable.php b/app/Http/Livewire/Tables/ProjectProposalTable.php deleted file mode 100644 index eb276513..00000000 --- a/app/Http/Livewire/Tables/ProjectProposalTable.php +++ /dev/null @@ -1,70 +0,0 @@ -setPrimaryKey('id') - ->setAdditionalSelects(['project_proposals.id', 'project_proposals.created_by', 'project_proposals.slug', 'project_proposals.user_id']) - ->setThAttributes(function (Column $column) { - return [ - 'class' => 'px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider dark:bg-gray-800 dark:text-gray-400', - 'default' => false, - ]; - }) - ->setTdAttributes(function (Column $column, $row, $columnIndex, $rowIndex) { - return [ - 'class' => 'px-6 py-4 text-sm font-medium dark:text-white', - 'default' => false, - ]; - }) - ->setColumnSelectStatus(false) - ->setPerPage(10) - ->setConfigurableAreas([ - 'toolbar-left-end' => [ - 'columns.project_proposals.areas.toolbar-left-end', [ - 'country' => $this->country, - ], - ], - ]); - } - - public function columns(): array - { - return [ - Column::make("Id", "id") - ->sortable(), - Column::make(__('From')) - ->label( - fn ($row, Column $column) => view('columns.project_proposals.author')->withRow($row) - ), - Column::make("Name", "name") - ->sortable(), - Column::make(__('Intended support in sats'), "support_in_sats") - ->format( - fn ($value, $row, Column $column) => number_format($value, 0, ',', '.') - ) - ->sortable(), - Column::make('') - ->label( - fn ($row, Column $column) => view('columns.project_proposals.action')->withRow($row)->withCountry($this->country) - ), - ]; - } - - public function builder(): Builder - { - return ProjectProposal::query()->with(['user']); - } -} diff --git a/app/Http/Livewire/Tables/VenueTable.php b/app/Http/Livewire/Tables/VenueTable.php deleted file mode 100644 index a9a7f599..00000000 --- a/app/Http/Livewire/Tables/VenueTable.php +++ /dev/null @@ -1,102 +0,0 @@ -setPrimaryKey('id') - ->setAdditionalSelects(['venues.id', 'venues.created_by']) - ->setThAttributes(function (Column $column) { - return [ - 'class' => 'px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider dark:bg-gray-800 dark:text-gray-400', - 'default' => false, - ]; - }) - ->setTdAttributes(function (Column $column, $row, $columnIndex, $rowIndex) { - return [ - 'class' => 'px-6 py-4 text-sm font-medium dark:text-white', - 'default' => false, - ]; - }) - ->setColumnSelectStatus(false) - ->setPerPage(10) - ->setConfigurableAreas([ - 'toolbar-left-end' => [ - 'columns.venues.areas.toolbar-left-end', [ - 'country' => $this->country, - ], - ], - ]); - } - - public function columns(): array - { - return [ - ImageColumn::make('Bild') - ->location( - fn ($row) => $row->getFirstMediaUrl('images', 'thumb') - ) - ->attributes(fn ($row) => [ - 'class' => 'rounded h-16 w-16', - 'alt' => $row->name.' Avatar', - ]) - ->collapseOnMobile(), - Column::make('Name', 'name') - ->searchable(fn ($query, $term) => $query->where('name', 'ilike', '%'.$term.'%')) - ->sortable(), - Column::make('Street', 'street') - ->sortable() - ->collapseOnMobile(), - Column::make('Termine') - ->label( - fn ($row, Column $column) => $row->course_events_count - ) - ->collapseOnMobile(), - Column::make('') - ->label( - fn ($row, Column $column) => view('columns.venues.action')->withRow($row)->withManage($this->manage) - ), - ]; - } - - public function builder(): Builder - { - return Venue::query() - ->withCount([ - 'courseEvents', - ]) - ->whereHas('city.country', fn ($query) => $query->where('code', $this->country)) - ->orderByDesc('course_events_count') - ->orderBy('venues.id'); - } - - public function venueSearch($id) - { - $venue = Venue::query() - ->find($id); - - return to_route('school.table.event', [ - '#table', - 'country' => $this->country, - 'course_events' => [ - 'filters' => [ - 'venue' => $venue->name, - ], - ], - ]); - } -} diff --git a/app/Http/Livewire/Venue/Form/VenueForm.php b/app/Http/Livewire/Venue/Form/VenueForm.php deleted file mode 100644 index 9808a7f8..00000000 --- a/app/Http/Livewire/Venue/Form/VenueForm.php +++ /dev/null @@ -1,89 +0,0 @@ - ['except' => '']]; - - protected $listeners = ['refresh' => '$refresh']; - - public function rules() - { - return [ - 'images.*' => [Rule::requiredIf(!$this->venue->id), 'nullable', 'mimes:jpeg,png,jpg,gif', 'max:10240'], - - 'venue.city_id' => 'required', - 'venue.name' => [ - 'required', - Rule::unique('venues', 'name') - ->ignore($this->venue), - ], - 'venue.street' => 'required', - ]; - } - - public function mount() - { - if (!$this->venue) { - $this->venue = new Venue(); - } elseif (!auth() - ->user() - ->can('update', $this->venue)) { - abort(403); - } - - if (!$this->fromUrl) { - $this->fromUrl = url()->previous(); - } - } - - public function deleteMedia($id) - { - Media::query() - ->find($id) - ->delete(); - $this->notification() - ->success(__('Image deleted!')); - $this->emit('refresh'); - } - - public function submit() - { - $this->validate(); - $this->venue->save(); - - if ($this->images && count($this->images) > 0) { - foreach ($this->images as $item) { - $this->venue->addMedia($item) - ->usingFileName(md5($item->getClientOriginalName()).'.'.$item->getClientOriginalExtension()) - ->toMediaCollection('images'); - } - } - - return redirect($this->fromUrl); - } - - public function render() - { - return view('livewire.venue.form.venue-form'); - } -} diff --git a/app/Http/Livewire/Wallet/LightningWallet.php b/app/Http/Livewire/Wallet/LightningWallet.php deleted file mode 100644 index f501f7e8..00000000 --- a/app/Http/Livewire/Wallet/LightningWallet.php +++ /dev/null @@ -1,71 +0,0 @@ - 'required', - 'url' => 'required', - 'lnurl' => 'required', - 'qrCode' => 'required', - ]; - } - - public function mount() - { - $this->k1 = bin2hex(str()->random(32)); - if (app()->environment('local')) { - $this->url = 'https://einundzwanzig.eu-1.sharedwithexpose.com/api/lnurl-auth-callback?tag=login&k1='.$this->k1.'&action=login'; - } else { - $this->url = url('/api/lnurl-auth-callback?tag=login&k1='.$this->k1.'&action=login'); - } - $this->lnurl = lnurl\encodeUrl($this->url); - $this->qrCode = base64_encode(QrCode::format('png') - ->size(300) - ->merge('/public/android-chrome-192x192.png', .3) - ->errorCorrection('H') - ->generate($this->lnurl)); - } - - public function confirm() - { - $user = auth()->user(); - $user->change = $this->k1; - $user->change_time = now(); - $user->save(); - $this->confirmed = true; - } - - public function checkAuth() - { - $loginKey = LoginKey::query() - ->where('k1', $this->k1) - ->whereDate('created_at', '>=', now()->subMinutes(5)) - ->first(); - // you should also restrict this 👆🏻 by time, and find only the $k1 that were created in the last 5 minutes - - if ($loginKey) { - return to_route('welcome'); - } - } - - public function render() - { - return view('livewire.wallet.lightning-wallet'); - } -} diff --git a/resources/views/api/api-token-manager.blade.php b/resources/views/api/api-token-manager.blade.php deleted file mode 100644 index 1391fb70..00000000 --- a/resources/views/api/api-token-manager.blade.php +++ /dev/null @@ -1,169 +0,0 @@ -
- @endif
-
- @endif
- | Name | -Status | -
|---|---|
| {{ $a['name'] }} | -{{ $a['status'] }} | -
{{ $orangePill->comment }}
-{{ $orangePill->comment }}
-{{ $orangePill->date->asDateTime() }}
-Name
-{{ $bookCase->title }}
-Link
-- {{ $this->url_to_absolute($bookCase->homepage) }} -
-Adresse
-{{ $bookCase->address }}
-Art
-{{ $bookCase->type }}
-Geöffnet
-{{ $bookCase->open }}
-Kontakt
-{{ $bookCase->contact }}
-Information
-{{ $bookCase->comment }}
-{{ __('You get a point when you log in.') }}
-
- - 210 {{ __('points') }}
-{{ $orangePill->date->asDate() }}
-{{ $orangePill->bookCase->title }}
-{{ $orangePill->bookCase->address }}
- -- {{ __('This chat is limited by 21 messages.') }} -
-- {{ __('Built with ❤️ by our team.') }} -
- -- {{ __('Yes') }}: {{ $item->votes->where('value', 1)->count() }} / {{ __('No') }}: {{ $item->votes->where('value', 0)->count() }} -
-- {{ __('From') }}: {{ $item->user->name }} -
-- {{ $item->bookCase->address }} -
-- {{ $item->course->description }} -
-- {{ $item->bookCase->address }} -
-{{ __('Bitcoin Portal') }}
-- {{ __('A Bitcoin community for all.') }} -
-- {{ __('Find Bitcoin courses in your city') }} -
- - {{ __('👇 Find a course 👇') }} - -{{-- TEXT --}}
-
--}}
-
- {{ $libraryItem->name }}
-{{ strip_tags($libraryItem->excerpt) }}
- -{{ $episode->data['title'] }}
-{{ strip_tags($episode->data['description']) }}
- --- ---{{ $meetup->intro }}
-
{{ $a['name'] }}
-{{ __('Participation confirmed') }}
-{{ $a['name'] }}
-{{ __('Perhaps') }}
-- {{ __('When') }}: {{ $meetupEvent->start->asDateTime() }} -
-- {{ __('Where') }}: {{ $meetupEvent->location }} -
-- {{ $item['display_name'] }}
-
-
{{ $jsonEncodedSelectedItem }}
- {{ $jsonEncodedSimplifiedGeoJson }}
- {{ $jsonEncodedGeoJsonWater }}
- {{ $jsonEncodedGeoJsonOSMFr }}
- - GeoJSON helper is maintained by HolgerHatGarKeineNode [npub1pt0kw36ue3w2g4haxq3wgm6a2fhtptmzsjlc2j2vphtcgle72qesgpjyc6]. - This - software is open-sourced software - licensed under the MIT license. -
-
- {{ $libraryItem->name }}
-{{ strip_tags($libraryItem->excerpt) }}
- -- {{ __('Click on any of the authors to see their articles.') }} -
-- {{ $author->library_items_count }} {{ __('articles') }} -
-{{ __('As a guest, please save your payment hash so that you can unlock this article later. Unfortunately, we cannot save your purchase status permanently for guests. Please log in to use this feature.') }}
-- {{ __('An overview of all Einundzwanzig plebs who have shared their npub.') }} -
- @auth -
- {{ __('Go to your profile and add your Nostr-npub. After that you can also log in with Nostr here on the portal.') }}
-
- {{ __('Profile') }}
-
-
- {{ __('Log in with your Nostr Extension so you can follow all plebs with one click.') }} -
-- You should stack sats as long as this page loads here. This is a low time preference loading bar. 🤙 -
- -
- Loadingstr...
- - You should stack sats as long as this page loads here. This is a low time preference loading bar. 🤙 -
- -
- Followstr...
- - {{ __('Enter the data of your LNBits instance here to receive sats for articles, for example.') }} -
-- {{ __('Select one or more meetup groups so that you can get access to these groups in the backend.') }} -
-- {{ __('Your current Meetup groups') }} -
-{{ $meetup->name }}
-{{ $meetup->city->name }}
-- {{ __('All courses of :name', ['name' => $lecturer->name]) }} -
-- {{ __('Here you can see all events of :name.', ['name' => $lecturer->name]) }} -
-
-
- Start am 17.06.2023 09:30 Uhr
-Besucht das Bitcoin Team 218 von Daktari und - Cercatrova.
-Gut Barsthorst, Hamburg
-
-
-
- {{ __('When two factor authentication is enabled, you will be prompted for a secure, random token during authentication. You may retrieve this token from your phone\'s Google Authenticator application.') }} -
-- @if ($showingConfirmation) - {{ __('To finish enabling two factor authentication, scan the following QR code using your phone\'s authenticator application or enter the setup key and provide the generated OTP code.') }} - @else - {{ __('Two factor authentication is now enabled. Scan the following QR code using your phone\'s authenticator application or enter the setup key.') }} - @endif -
-- {{ __('Setup Key') }}: {{ decrypt($this->user->two_factor_secret) }} -
-- {{ __('Store these recovery codes in a secure password manager. They can be used to recover access to your account if your two factor authentication device is lost.') }} -
-{{ __('Only one working address is required. But you can also fill in all fields if you have suitable data.') }}
-{{ __('starts with PM...') }}
-{{ __('for example xy@getalby.com') }}
-{{ __('starts with: lnurl1dp68gurn8gh....') }}
-- {{ __('Your email address is unverified.') }} - - -
- - @if ($this->verificationLinkSent) -- {{ __('A new verification link has been sent to your email address.') }} -
- @endif - @endif -