Apply Laravel coding style

Shift automatically applies the Laravel coding style - which uses the PSR-12 coding style as a base with some minor additions.

You may customize the code style applied by configuring [Pint](https://laravel.com/docs/pint), [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer), or [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) for your project root.

For more information on customizing the code style applied by Shift, [watch this short video](https://laravelshift.com/videos/shift-code-style).
This commit is contained in:
Shift
2023-02-19 16:18:46 +00:00
committed by HolgerHatGarKeineNode
parent a15ca4a2bc
commit 5776b01d15
333 changed files with 4915 additions and 4967 deletions

View File

@@ -18,25 +18,24 @@ class CreateNewUser implements CreatesNewUsers
* Create a newly registered user. * Create a newly registered user.
* *
* @param array $input * @param array $input
*
* @return \App\Models\User * @return \App\Models\User
*/ */
public function create(array $input) public function create(array $input)
{ {
Validator::make($input, [ Validator::make($input, [
'name' => ['required', 'string', 'max:255'], 'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => app()->environment('local') ? 'required' : $this->passwordRules(), 'password' => app()->environment('local') ? 'required' : $this->passwordRules(),
'terms' => Jetstream::hasTermsAndPrivacyPolicyFeature() ? ['accepted', 'required'] : '', 'terms' => Jetstream::hasTermsAndPrivacyPolicyFeature() ? ['accepted', 'required'] : '',
'is_lecturer' => ['required'], 'is_lecturer' => ['required'],
]) ])
->validate(); ->validate();
return DB::transaction(function () use ($input) { return DB::transaction(function () use ($input) {
return tap(User::create([ return tap(User::create([
'name' => $input['name'], 'name' => $input['name'],
'email' => $input['email'], 'email' => $input['email'],
'password' => Hash::make($input['password']), 'password' => Hash::make($input['password']),
'is_lecturer' => $input['is_lecturer'] === 'on', 'is_lecturer' => $input['is_lecturer'] === 'on',
]), function (User $user) { ]), function (User $user) {
$this->createTeam($user); $this->createTeam($user);
@@ -48,15 +47,14 @@ class CreateNewUser implements CreatesNewUsers
* Create a personal team for the user. * Create a personal team for the user.
* *
* @param \App\Models\User $user * @param \App\Models\User $user
*
* @return void * @return void
*/ */
protected function createTeam(User $user) protected function createTeam(User $user)
{ {
$user->ownedTeams() $user->ownedTeams()
->save(Team::forceCreate([ ->save(Team::forceCreate([
'user_id' => $user->id, 'user_id' => $user->id,
'name' => explode(' ', $user->name, 2)[0]."'s Team", 'name' => explode(' ', $user->name, 2)[0]."'s Team",
'personal_team' => true, 'personal_team' => true,
])); ]));
} }

View File

@@ -8,6 +8,7 @@ trait PasswordValidationRules
{ {
/** /**
* Get the validation rules used to validate passwords. * Get the validation rules used to validate passwords.
*
* @return array * @return array
*/ */
protected function passwordRules() protected function passwordRules()

View File

@@ -14,22 +14,21 @@ class UpdateUserProfileInformation implements UpdatesUserProfileInformation
* *
* @param mixed $user * @param mixed $user
* @param array $input * @param array $input
*
* @return void * @return void
*/ */
public function update($user, array $input) public function update($user, array $input)
{ {
Validator::make($input, [ Validator::make($input, [
'name' => ['required', 'string', 'max:255'], 'name' => ['required', 'string', 'max:255'],
'lightning_address' => ['nullable', 'string'], 'lightning_address' => ['nullable', 'string'],
'lnurl' => ['nullable', 'string'], 'lnurl' => ['nullable', 'string'],
'node_id' => ['nullable', 'string', 'max:66'], 'node_id' => ['nullable', 'string', 'max:66'],
'timezone' => ['required', 'string'], 'timezone' => ['required', 'string'],
'email' => [ 'email' => [
'nullable', 'email', 'max:255', Rule::unique('users') 'nullable', 'email', 'max:255', Rule::unique('users')
->ignore($user->id) ->ignore($user->id),
], ],
'photo' => ['nullable', 'mimes:jpg,jpeg,png,gif', 'max:10240'], 'photo' => ['nullable', 'mimes:jpg,jpeg,png,gif', 'max:10240'],
]) ])
->validateWithBag('updateProfileInformation'); ->validateWithBag('updateProfileInformation');
@@ -42,12 +41,12 @@ class UpdateUserProfileInformation implements UpdatesUserProfileInformation
$this->updateVerifiedUser($user, $input); $this->updateVerifiedUser($user, $input);
} else { } else {
$user->forceFill([ $user->forceFill([
'name' => $input['name'], 'name' => $input['name'],
'lightning_address' => $input['lightning_address'], 'lightning_address' => $input['lightning_address'],
'lnurl' => $input['lnurl'], 'lnurl' => $input['lnurl'],
'node_id' => $input['node_id'], 'node_id' => $input['node_id'],
'email' => $input['email'], 'email' => $input['email'],
'timezone' => $input['timezone'], 'timezone' => $input['timezone'],
]) ])
->save(); ->save();
} }
@@ -58,18 +57,17 @@ class UpdateUserProfileInformation implements UpdatesUserProfileInformation
* *
* @param mixed $user * @param mixed $user
* @param array $input * @param array $input
*
* @return void * @return void
*/ */
protected function updateVerifiedUser($user, array $input) protected function updateVerifiedUser($user, array $input)
{ {
$user->forceFill([ $user->forceFill([
'name' => $input['name'], 'name' => $input['name'],
'lightning_address' => $input['lightning_address'], 'lightning_address' => $input['lightning_address'],
'lnurl' => $input['lnurl'], 'lnurl' => $input['lnurl'],
'node_id' => $input['node_id'], 'node_id' => $input['node_id'],
'email' => $input['email'], 'email' => $input['email'],
'timezone' => $input['timezone'], 'timezone' => $input['timezone'],
'email_verified_at' => null, 'email_verified_at' => null,
]) ])
->save(); ->save();

View File

@@ -9,18 +9,21 @@ class CleanupLoginKeys extends Command
{ {
/** /**
* The name and signature of the console command. * The name and signature of the console command.
*
* @var string * @var string
*/ */
protected $signature = 'loginkeys:cleanup'; protected $signature = 'loginkeys:cleanup';
/** /**
* The console command description. * The console command description.
*
* @var string * @var string
*/ */
protected $description = 'Command description'; protected $description = 'Command description';
/** /**
* Execute the console command. * Execute the console command.
*
* @return int * @return int
*/ */
public function handle() public function handle()

View File

@@ -8,18 +8,21 @@ class CreatePermissions extends Command
{ {
/** /**
* The name and signature of the console command. * The name and signature of the console command.
*
* @var string * @var string
*/ */
protected $signature = 'permissions:create'; protected $signature = 'permissions:create';
/** /**
* The console command description. * The console command description.
*
* @var string * @var string
*/ */
protected $description = 'Command description'; protected $description = 'Command description';
/** /**
* Execute the console command. * Execute the console command.
*
* @return int * @return int
*/ */
public function handle() public function handle()

View File

@@ -9,18 +9,21 @@ class CreateTags extends Command
{ {
/** /**
* The name and signature of the console command. * The name and signature of the console command.
*
* @var string * @var string
*/ */
protected $signature = 'tags:create'; protected $signature = 'tags:create';
/** /**
* The console command description. * The console command description.
*
* @var string * @var string
*/ */
protected $description = 'Command description'; protected $description = 'Command description';
/** /**
* Execute the console command. * Execute the console command.
*
* @return int * @return int
*/ */
public function handle() public function handle()

View File

@@ -9,18 +9,21 @@ class FillUserEmails extends Command
{ {
/** /**
* The name and signature of the console command. * The name and signature of the console command.
*
* @var string * @var string
*/ */
protected $signature = 'users:emails'; protected $signature = 'users:emails';
/** /**
* The console command description. * The console command description.
*
* @var string * @var string
*/ */
protected $description = 'Command description'; protected $description = 'Command description';
/** /**
* Execute the console command. * Execute the console command.
*
* @return int * @return int
*/ */
public function handle() public function handle()
@@ -29,7 +32,7 @@ class FillUserEmails extends Command
foreach ($users as $user) { foreach ($users as $user) {
// set email // set email
if (!$user->email) { if (! $user->email) {
$user->email = str($user->public_key)->substr(-12).'@portal.einundzwanzig.space'; $user->email = str($user->public_key)->substr(-12).'@portal.einundzwanzig.space';
$user->save(); $user->save();
} }

View File

@@ -11,18 +11,21 @@ class ImportGithubMeetups extends Command
{ {
/** /**
* The name and signature of the console command. * The name and signature of the console command.
*
* @var string * @var string
*/ */
protected $signature = 'import:meetups'; protected $signature = 'import:meetups';
/** /**
* The console command description. * The console command description.
*
* @var string * @var string
*/ */
protected $description = 'Command description'; protected $description = 'Command description';
/** /**
* Execute the console command. * Execute the console command.
*
* @return int * @return int
*/ */
public function handle() public function handle()
@@ -36,19 +39,19 @@ class ImportGithubMeetups extends Command
'country_id' => Country::firstOrCreate([ 'country_id' => Country::firstOrCreate([
'code' => str($meetup['country']) 'code' => str($meetup['country'])
->lower() ->lower()
->toString() ->toString(),
], ['name' => $meetup['country']])->id, ], ['name' => $meetup['country']])->id,
'longitude' => $meetup['longitude'], 'longitude' => $meetup['longitude'],
'latitude' => $meetup['latitude'], 'latitude' => $meetup['latitude'],
'created_by' => 1, 'created_by' => 1,
]); ]);
$meetup = Meetup::updateOrCreate( $meetup = Meetup::updateOrCreate(
['name' => $meetup['name']], ['name' => $meetup['name']],
[ [
'city_id' => $city->id, 'city_id' => $city->id,
'webpage' => $meetup['url'], 'webpage' => $meetup['url'],
'created_by' => 1, 'created_by' => 1,
'community' => 'einundzwanzig' 'community' => 'einundzwanzig',
]); ]);
} }

View File

@@ -9,18 +9,21 @@ class MigrateMeetupSlugs extends Command
{ {
/** /**
* The name and signature of the console command. * The name and signature of the console command.
*
* @var string * @var string
*/ */
protected $signature = 'meetups:slugs'; protected $signature = 'meetups:slugs';
/** /**
* The console command description. * The console command description.
*
* @var string * @var string
*/ */
protected $description = 'Command description'; protected $description = 'Command description';
/** /**
* Execute the console command. * Execute the console command.
*
* @return int * @return int
*/ */
public function handle() public function handle()

View File

@@ -10,18 +10,21 @@ class RenameFileToMd5 extends Command
{ {
/** /**
* The name and signature of the console command. * The name and signature of the console command.
*
* @var string * @var string
*/ */
protected $signature = 'files:md5'; protected $signature = 'files:md5';
/** /**
* The console command description. * The console command description.
*
* @var string * @var string
*/ */
protected $description = 'Command description'; protected $description = 'Command description';
/** /**
* Execute the console command. * Execute the console command.
*
* @return int * @return int
*/ */
public function handle() public function handle()

View File

@@ -10,18 +10,21 @@ class SetReputation extends Command
{ {
/** /**
* The name and signature of the console command. * The name and signature of the console command.
*
* @var string * @var string
*/ */
protected $signature = 'reputation:set'; protected $signature = 'reputation:set';
/** /**
* The console command description. * The console command description.
*
* @var string * @var string
*/ */
protected $description = 'Command description'; protected $description = 'Command description';
/** /**
* Execute the console command. * Execute the console command.
*
* @return int * @return int
*/ */
public function handle() public function handle()

View File

@@ -10,18 +10,21 @@ class SyncGithubMeetups extends Command
{ {
/** /**
* The name and signature of the console command. * The name and signature of the console command.
*
* @var string * @var string
*/ */
protected $signature = 'meetups:github-sync'; protected $signature = 'meetups:github-sync';
/** /**
* The console command description. * The console command description.
*
* @var string * @var string
*/ */
protected $description = 'Command description'; protected $description = 'Command description';
/** /**
* Execute the console command. * Execute the console command.
*
* @return int * @return int
*/ */
public function handle() public function handle()
@@ -42,9 +45,9 @@ class SyncGithubMeetups extends Command
$this->info('Missing: '.$meetup['name'].' Url: '.$meetup['url']); $this->info('Missing: '.$meetup['name'].' Url: '.$meetup['url']);
if (app()->environment('local')) { if (app()->environment('local')) {
Meetup::create([ Meetup::create([
'name' => $meetup['name'], 'name' => $meetup['name'],
'city_id' => 1, 'city_id' => 1,
'created_by' => 1, 'created_by' => 1,
'github_data' => $meetup, 'github_data' => $meetup,
]); ]);
} }

View File

@@ -11,25 +11,28 @@ class ReadAndSyncPodcastFeeds extends Command
{ {
/** /**
* The name and signature of the console command. * The name and signature of the console command.
*
* @var string * @var string
*/ */
protected $signature = 'feed:sync'; protected $signature = 'feed:sync';
/** /**
* The console command description. * The console command description.
*
* @var string * @var string
*/ */
protected $description = 'Command description'; protected $description = 'Command description';
/** /**
* Execute the console command. * Execute the console command.
*
* @return int * @return int
*/ */
public function handle() public function handle()
{ {
$client = new \PodcastIndex\Client([ $client = new \PodcastIndex\Client([
'app' => 'Einundzwanzig School', 'app' => 'Einundzwanzig School',
'key' => config('feeds.services.podcastindex-org.key'), 'key' => config('feeds.services.podcastindex-org.key'),
'secret' => config('feeds.services.podcastindex-org.secret'), 'secret' => config('feeds.services.podcastindex-org.secret'),
]); ]);
$feedIds = [ $feedIds = [
@@ -64,11 +67,11 @@ class ReadAndSyncPodcastFeeds extends Command
$this->info('Importing: '.$podcast->feed->title); $this->info('Importing: '.$podcast->feed->title);
$importPodcast = Podcast::query() $importPodcast = Podcast::query()
->updateOrCreate(['guid' => $podcast->feed->podcastGuid], [ ->updateOrCreate(['guid' => $podcast->feed->podcastGuid], [
'title' => $podcast->feed->title, 'title' => $podcast->feed->title,
'link' => $podcast->feed->link, 'link' => $podcast->feed->link,
'language_code' => $podcast->feed->language, 'language_code' => $podcast->feed->language,
'data' => $podcast->feed, 'data' => $podcast->feed,
'created_by' => 1, 'created_by' => 1,
]); ]);
$episodes = $client->episodes->withParameters(['max' => 10000]) $episodes = $client->episodes->withParameters(['max' => 10000])
->byFeedId($feedId) ->byFeedId($feedId)
@@ -77,7 +80,7 @@ class ReadAndSyncPodcastFeeds extends Command
Episode::query() Episode::query()
->updateOrCreate(['guid' => $item->guid], [ ->updateOrCreate(['guid' => $item->guid], [
'podcast_id' => $importPodcast->id, 'podcast_id' => $importPodcast->id,
'data' => $item, 'data' => $item,
'created_by' => 1, 'created_by' => 1,
'created_at' => Carbon::parse($item->datePublished), 'created_at' => Carbon::parse($item->datePublished),
]); ]);

View File

@@ -9,18 +9,21 @@ class CreateGeoJsonPolygon extends Command
{ {
/** /**
* The name and signature of the console command. * The name and signature of the console command.
*
* @var string * @var string
*/ */
protected $signature = 'map:polygon'; protected $signature = 'map:polygon';
/** /**
* The console command description. * The console command description.
*
* @var string * @var string
*/ */
protected $description = 'Command description'; protected $description = 'Command description';
/** /**
* Execute the console command. * Execute the console command.
*
* @return int * @return int
*/ */
public function handle() public function handle()

View File

@@ -10,18 +10,21 @@ class SyncOpenBooks extends Command
{ {
/** /**
* The name and signature of the console command. * The name and signature of the console command.
*
* @var string * @var string
*/ */
protected $signature = 'books:sync'; protected $signature = 'books:sync';
/** /**
* The console command description. * The console command description.
*
* @var string * @var string
*/ */
protected $description = 'Command description'; protected $description = 'Command description';
/** /**
* Execute the console command. * Execute the console command.
*
* @return int * @return int
*/ */
public function handle() public function handle()
@@ -30,30 +33,29 @@ class SyncOpenBooks extends Command
$ids = collect($response->json()['cases'])->pluck('id'); $ids = collect($response->json()['cases'])->pluck('id');
try { try {
foreach ($response->json()['cases'] as $case) { foreach ($response->json()['cases'] as $case) {
BookCase::updateOrCreate( BookCase::updateOrCreate(
[ [
'id' => $case['id'], 'id' => $case['id'],
], ],
[ [
'id' => $case['id'], 'id' => $case['id'],
'title' => $case['title'], 'title' => $case['title'],
'latitude' => (float) $case['lat'], 'latitude' => (float) $case['lat'],
'longitude' => (float) $case['lon'], 'longitude' => (float) $case['lon'],
'address' => $case['address'], 'address' => $case['address'],
'type' => $case['type'], 'type' => $case['type'],
'open' => $case['open'], 'open' => $case['open'],
'comment' => $case['comment'], 'comment' => $case['comment'],
'contact' => $case['contact'], 'contact' => $case['contact'],
'bcz' => $case['bcz'], 'bcz' => $case['bcz'],
'digital' => $case['digital'] ?? false, 'digital' => $case['digital'] ?? false,
'icontype' => $case['icontype'], 'icontype' => $case['icontype'],
'deactivated' => $case['deactivated'], 'deactivated' => $case['deactivated'],
'deactreason' => $case['deactreason'], 'deactreason' => $case['deactreason'],
'entrytype' => $case['entrytype'], 'entrytype' => $case['entrytype'],
'homepage' => $case['homepage'], 'homepage' => $case['homepage'],
'created_by' => 1, 'created_by' => 1,
] ]
); );
} }

View File

@@ -11,109 +11,111 @@ class ImportLibraryItems extends Command
{ {
/** /**
* The name and signature of the console command. * The name and signature of the console command.
*
* @var string * @var string
*/ */
protected $signature = 'import:l'; protected $signature = 'import:l';
/** /**
* The console command description. * The console command description.
*
* @var string * @var string
*/ */
protected $description = 'Command description'; protected $description = 'Command description';
/** /**
* Execute the console command. * Execute the console command.
*
* @return int * @return int
*/ */
public function handle() public function handle()
{ {
$items = [ $items = [
'https://aprycot.media/blog/weg-zum-bitcoin-standard/' => 'Auf dem Weg zu einem Bitcoin-Standard || Gigi', 'https://aprycot.media/blog/weg-zum-bitcoin-standard/' => 'Auf dem Weg zu einem Bitcoin-Standard || Gigi',
'https://europeanbitcoiners.com/warum-wir-eine-konstante-geldmenge-benoetigen/' => 'B ~ C: Warum wir eine konstante Geldmenge benötigen || Aleksander Svetski', 'https://europeanbitcoiners.com/warum-wir-eine-konstante-geldmenge-benoetigen/' => 'B ~ C: Warum wir eine konstante Geldmenge benötigen || Aleksander Svetski',
'https://aprycot.media/blog/bitcoin-bringt-das-in-ordnung/' => 'Bitcoin bringt das in Ordnung || Parker Lewis', 'https://aprycot.media/blog/bitcoin-bringt-das-in-ordnung/' => 'Bitcoin bringt das in Ordnung || Parker Lewis',
'https://europeanbitcoiners.com/orange-new-deal/' => 'Bitcoin: der Orange New Deal || Andrew M. Baily & Bradley Rettler', 'https://europeanbitcoiners.com/orange-new-deal/' => 'Bitcoin: der Orange New Deal || Andrew M. Baily & Bradley Rettler',
'https://aprycot.media/blog/bitcoin-die-welt-wacht-auf/' => 'Bitcoin - die Welt wacht auf || Gigi', 'https://aprycot.media/blog/bitcoin-die-welt-wacht-auf/' => 'Bitcoin - die Welt wacht auf || Gigi',
'https://aprycot.media/blog/bitcoin-ist-einer-fuer-alle/' => 'Bitcoin ist \'Einer für Alle\' || Parker Lewis', 'https://aprycot.media/blog/bitcoin-ist-einer-fuer-alle/' => 'Bitcoin ist \'Einer für Alle\' || Parker Lewis',
'https://europeanbitcoiners.com/bitcoin-ist-energie-die-durch-die-zeit-reisen-kann/' => 'Bitcoin ist Energie, die durch die Zeit reisen kann || Michael Dunworth', 'https://europeanbitcoiners.com/bitcoin-ist-energie-die-durch-die-zeit-reisen-kann/' => 'Bitcoin ist Energie, die durch die Zeit reisen kann || Michael Dunworth',
'https://aprycot.media/blog/bitcoin-ist-hoffnung/' => 'Bitcoin ist Hoffnung || Robert Breedlove', 'https://aprycot.media/blog/bitcoin-ist-hoffnung/' => 'Bitcoin ist Hoffnung || Robert Breedlove',
'https://aprycot.media/blog/bitcoin-ist-schlechter-ist-besser/' => 'Bitcoin ist “Schlechter ist Besser” || Gwern Branwen', 'https://aprycot.media/blog/bitcoin-ist-schlechter-ist-besser/' => 'Bitcoin ist “Schlechter ist Besser” || Gwern Branwen',
'https://blog.karlklawatsch.com/bitcoin/bitcoin-ist-zeit/' => 'Bitcoin ist Zeit || Gigi', 'https://blog.karlklawatsch.com/bitcoin/bitcoin-ist-zeit/' => 'Bitcoin ist Zeit || Gigi',
'https://aprycot.media/blog/bitcoin-ist-antifragil/' => 'Bitcoin ist antifragil || Parker Lewis', 'https://aprycot.media/blog/bitcoin-ist-antifragil/' => 'Bitcoin ist antifragil || Parker Lewis',
'https://aprycot.media/blog/bitcoin-ist-die-grosse-entfinanzialisierung/' => 'Bitcoin ist die große Entfinanzialisierung || Parker Lewis', 'https://aprycot.media/blog/bitcoin-ist-die-grosse-entfinanzialisierung/' => 'Bitcoin ist die große Entfinanzialisierung || Parker Lewis',
'https://aprycot.media/blog/bitcoin-ist-nicht-durch-nichts-gedeckt/' => 'Bitcoin ist durch nichts gedeckt || Parker Lewis', 'https://aprycot.media/blog/bitcoin-ist-nicht-durch-nichts-gedeckt/' => 'Bitcoin ist durch nichts gedeckt || Parker Lewis',
'https://aprycot.media/blog/bitcoin-ist-ein-aufschrei/' => 'Bitcoin ist ein Aufschrei || Parker Lewis', 'https://aprycot.media/blog/bitcoin-ist-ein-aufschrei/' => 'Bitcoin ist ein Aufschrei || Parker Lewis',
'https://aprycot.media/blog/bitcoin-ist-ein-trojanisches-pferd-der-freiheit/' => 'Bitcoin ist ein trojanisches Pferd der Freiheit || Alex Gladstein', 'https://aprycot.media/blog/bitcoin-ist-ein-trojanisches-pferd-der-freiheit/' => 'Bitcoin ist ein trojanisches Pferd der Freiheit || Alex Gladstein',
'https://aprycot.media/blog/bitcoin-ist-gesunder-menschenverstand/' => 'Bitcoin ist gesunder Menschenverstand || Parker Lewis', 'https://aprycot.media/blog/bitcoin-ist-gesunder-menschenverstand/' => 'Bitcoin ist gesunder Menschenverstand || Parker Lewis',
'https://aprycot.media/blog/bitcoin-ist-kein-schneeballsystem/' => 'Bitcoin ist kein Schneeballsystem || Parker Lewis', 'https://aprycot.media/blog/bitcoin-ist-kein-schneeballsystem/' => 'Bitcoin ist kein Schneeballsystem || Parker Lewis',
'https://aprycot.media/blog/bitcoin-ist-keine-energieverschwendung/' => 'Bitcoin ist keine Energieverschwendung || Parker Lewis', 'https://aprycot.media/blog/bitcoin-ist-keine-energieverschwendung/' => 'Bitcoin ist keine Energieverschwendung || Parker Lewis',
'https://aprycot.media/blog/bitcoin-ist-nicht-zu-langsam/' => 'Bitcoin ist nicht zu langsam || Parker Lewis', 'https://aprycot.media/blog/bitcoin-ist-nicht-zu-langsam/' => 'Bitcoin ist nicht zu langsam || Parker Lewis',
'https://aprycot.media/blog/bitcoin-ist-nicht-zu-volatil/' => 'Bitcoin ist nicht zu volatil || Parker Lewis', 'https://aprycot.media/blog/bitcoin-ist-nicht-zu-volatil/' => 'Bitcoin ist nicht zu volatil || Parker Lewis',
'https://aprycot.media/blog/bitcoin-kann-nicht-kopiert-werden/' => 'Bitcoin kann nicht kopiert werden || Parker Lewis', 'https://aprycot.media/blog/bitcoin-kann-nicht-kopiert-werden/' => 'Bitcoin kann nicht kopiert werden || Parker Lewis',
'https://aprycot.media/blog/bitcoin-kann-nicht-verboten-werden/' => 'Bitcoin kann nicht verboten werden || Parker Lewis', 'https://aprycot.media/blog/bitcoin-kann-nicht-verboten-werden/' => 'Bitcoin kann nicht verboten werden || Parker Lewis',
'https://aprycot.media/blog/bitcoin-macht-anderes-geld-ueberfluessig/' => 'Bitcoin macht anderes Geld überflüssig || Parker Lewis', 'https://aprycot.media/blog/bitcoin-macht-anderes-geld-ueberfluessig/' => 'Bitcoin macht anderes Geld überflüssig || Parker Lewis',
'https://aprycot.media/blog/bitcoin-nicht-blockchain/' => 'Bitcoin, nicht Blockchain || Parker Lewis', 'https://aprycot.media/blog/bitcoin-nicht-blockchain/' => 'Bitcoin, nicht Blockchain || Parker Lewis',
'https://medium.com/aprycotmedia/bitcoins-anpflanzung-71ea533b89c5' => 'Bitcoins Anpflanzung || Dan Held', 'https://medium.com/aprycotmedia/bitcoins-anpflanzung-71ea533b89c5' => 'Bitcoins Anpflanzung || Dan Held',
'https://aprycot.media/blog/bitcoins-lebensraeume/' => 'Bitcoins Lebensräume || Gigi', 'https://aprycot.media/blog/bitcoins-lebensraeume/' => 'Bitcoins Lebensräume || Gigi',
'https://aprycot.media/blog/bitcoins-einsatz-vor-ort-venezuela/' => 'Bitcoins\'s Einsatz vor Ort - Venezuela || Gigi', 'https://aprycot.media/blog/bitcoins-einsatz-vor-ort-venezuela/' => 'Bitcoins\'s Einsatz vor Ort - Venezuela || Gigi',
'https://europeanbitcoiners.com/bitcoin-und-psychdelika/' => 'Bitcoin und Psychedelika || Fractalencrypt', 'https://europeanbitcoiners.com/bitcoin-und-psychdelika/' => 'Bitcoin und Psychedelika || Fractalencrypt',
'https://europeanbitcoiners.com/bitcoin-und-die-kardinaltugenden-wie-das-kaninchenloch-tugendhaftes-verhalten-fordert/' => 'Bitcoin und die Kardinaltugenden: wie der Kaninchenbau tugendhaftes Verhalten fördert || Mitchell Askew', 'https://europeanbitcoiners.com/bitcoin-und-die-kardinaltugenden-wie-das-kaninchenloch-tugendhaftes-verhalten-fordert/' => 'Bitcoin und die Kardinaltugenden: wie der Kaninchenbau tugendhaftes Verhalten fördert || Mitchell Askew',
'https://aprycot.media/blog/bitcoin-und-die-amerikanische-idee/' => 'Bitcoin und die amerikanische Idee || Parker Lewis', 'https://aprycot.media/blog/bitcoin-und-die-amerikanische-idee/' => 'Bitcoin und die amerikanische Idee || Parker Lewis',
'https://europeanbitcoiners.com/bitcoin-verkorpert-nikola-teslas-vision-fur-frieden-und-energieuberfluss/' => 'Bitcoin verkörpert Nikola Teslas Vision für Frieden und Energieüberfluss || Level39', 'https://europeanbitcoiners.com/bitcoin-verkorpert-nikola-teslas-vision-fur-frieden-und-energieuberfluss/' => 'Bitcoin verkörpert Nikola Teslas Vision für Frieden und Energieüberfluss || Level39',
'https://aprycot.media/blog/check-deine-finanziellen-privilegien/' => 'Check deine finanziellen Privilegien! || Alex Gladstein', 'https://aprycot.media/blog/check-deine-finanziellen-privilegien/' => 'Check deine finanziellen Privilegien! || Alex Gladstein',
'https://www.bitcoin.de/de/bitcoin-whitepaper-deutsch-html' => 'Das Bitcoin Whitepaper || Satoshi Nakamoto', 'https://www.bitcoin.de/de/bitcoin-whitepaper-deutsch-html' => 'Das Bitcoin Whitepaper || Satoshi Nakamoto',
'https://aprycot.media/blog/das-ei-des-phoenix/' => 'Das Ei des Phönix || Gigi', 'https://aprycot.media/blog/das-ei-des-phoenix/' => 'Das Ei des Phönix || Gigi',
'https://europeanbitcoiners.com/das-manifest-der-bitcoin-hodler-friedfertige-und-monetar-selbstsourverane-individuen/' => 'Das Manifest der Bitcoin Hodler: friedfertige und monetär selbstsouveräne Individuen || The Sovereign Hodler 21', 'https://europeanbitcoiners.com/das-manifest-der-bitcoin-hodler-friedfertige-und-monetar-selbstsourverane-individuen/' => 'Das Manifest der Bitcoin Hodler: friedfertige und monetär selbstsouveräne Individuen || The Sovereign Hodler 21',
'https://medium.com/aprycotmedia/das-bullische-argument-f%C3%BCr-bitcoin-9665e9375727' => 'Das bullische Argument für Bitcoin || Vijay Boyapati', 'https://medium.com/aprycotmedia/das-bullische-argument-f%C3%BCr-bitcoin-9665e9375727' => 'Das bullische Argument für Bitcoin || Vijay Boyapati',
'https://medium.com/aprycotmedia/das-monetaere-argument-fuer-bitcoin-62559a4c7b7d' => 'Das monetäre Argument für Bitcoin || Ben Kaufman', 'https://medium.com/aprycotmedia/das-monetaere-argument-fuer-bitcoin-62559a4c7b7d' => 'Das monetäre Argument für Bitcoin || Ben Kaufman',
'https://aprycot.media/blog/der-aufstieg-des-souveraenen-individuums/' => 'Der Aufstieg des souveränen Individuums || Gigi', 'https://aprycot.media/blog/der-aufstieg-des-souveraenen-individuums/' => 'Der Aufstieg des souveränen Individuums || Gigi',
'https://aprycot.media/blog/ewiger-kampf-||-bitcoin/' => 'Der ewige Kampf von Bitcoin || Gigi', 'https://aprycot.media/blog/ewiger-kampf-||-bitcoin/' => 'Der ewige Kampf von Bitcoin || Gigi',
'https://medium.com/aprycotmedia/die-bitcoin-reise-dab572e5ff72' => 'Die Bitcoin-Reise || Gigi', 'https://medium.com/aprycotmedia/die-bitcoin-reise-dab572e5ff72' => 'Die Bitcoin-Reise || Gigi',
'https://aprycot.media/blog/konsequenzen-bitcoin-verbot/' => 'Die Konsequenzen eines Bitcoin-Verbots || Gigi', 'https://aprycot.media/blog/konsequenzen-bitcoin-verbot/' => 'Die Konsequenzen eines Bitcoin-Verbots || Gigi',
'https://aprycot.media/blog/die-suche-nach-digitalem-bargeld/' => 'Die Suche nach digitalem Bargeld || Alex Gladstein', 'https://aprycot.media/blog/die-suche-nach-digitalem-bargeld/' => 'Die Suche nach digitalem Bargeld || Alex Gladstein',
'https://aprycot.media/blog/die-verantwortung-bitcoin-anzunehmen/' => 'Die Verantwortung, Bitcoin anzunehmen || Gigi', 'https://aprycot.media/blog/die-verantwortung-bitcoin-anzunehmen/' => 'Die Verantwortung, Bitcoin anzunehmen || Gigi',
'https://europeanbitcoiners.com/die-woerter-die-wir-in-bitcoin-verwenden/' => 'Die Wörter, die wir in Bitcoin verwenden || Gigi', 'https://europeanbitcoiners.com/die-woerter-die-wir-in-bitcoin-verwenden/' => 'Die Wörter, die wir in Bitcoin verwenden || Gigi',
'https://aprycot.media/blog/die-wurzel-allen-uebels/' => 'Die Wurzel allen Übels || Fab The Fox', 'https://aprycot.media/blog/die-wurzel-allen-uebels/' => 'Die Wurzel allen Übels || Fab The Fox',
'https://aprycot.media/blog/die-zahl-null-und-bitcoin/' => 'Die Zahl Null und Bitcoin || Robert Breedlove', 'https://aprycot.media/blog/die-zahl-null-und-bitcoin/' => 'Die Zahl Null und Bitcoin || Robert Breedlove',
'https://europeanbitcoiners.com/die-makellose-schoepfung-||-bitcoin/' => 'Die makellose Schöpfung von Bitcoin || Pascal Huegli', 'https://europeanbitcoiners.com/die-makellose-schoepfung-||-bitcoin/' => 'Die makellose Schöpfung von Bitcoin || Pascal Huegli',
'https://aprycot.media/blog/die-versteckten-kosten-des-petrodollars/' => 'Die versteckten Kosten des Petrodollars || Alex Gladstein', 'https://aprycot.media/blog/die-versteckten-kosten-des-petrodollars/' => 'Die versteckten Kosten des Petrodollars || Alex Gladstein',
'https://aprycot.media/blog/freiheit-und-privatsphaere-zwei-seiter-der-gleichen-muenze/' => 'Freiheit und Privatsphäre - Zwei Seiten der gleichen Medaille || Gigi', 'https://aprycot.media/blog/freiheit-und-privatsphaere-zwei-seiter-der-gleichen-muenze/' => 'Freiheit und Privatsphäre - Zwei Seiten der gleichen Medaille || Gigi',
'https://aprycot.media/blog/herren-und-sklaven-des-geldes/' => 'Herren und Sklaven des Geldes || Robert Breedlove', 'https://aprycot.media/blog/herren-und-sklaven-des-geldes/' => 'Herren und Sklaven des Geldes || Robert Breedlove',
'https://europeanbitcoiners.com/hyperbitcoinisierung-der-gewinner-bekommt-alles/' => 'Hyperbitcoinsierung: Der Gewinner bekommt alles || ObiWan Kenobit', 'https://europeanbitcoiners.com/hyperbitcoinisierung-der-gewinner-bekommt-alles/' => 'Hyperbitcoinsierung: Der Gewinner bekommt alles || ObiWan Kenobit',
'https://europeanbitcoiners.com/ist-der-preis-||-bitcoin-volatil-es-ist-alles-relativ/' => 'Ist der Preis von Bitcoin volatil? Es ist alles relativ || Tim Niemeyer', 'https://europeanbitcoiners.com/ist-der-preis-||-bitcoin-volatil-es-ist-alles-relativ/' => 'Ist der Preis von Bitcoin volatil? Es ist alles relativ || Tim Niemeyer',
'https://aprycot.media/blog/lebenszeichen/' => 'Lebenszeichen || Gigi', 'https://aprycot.media/blog/lebenszeichen/' => 'Lebenszeichen || Gigi',
'https://aprycot.media/blog/liebe-familie-liebe-freunde/' => 'Liebe Familie, liebe Freunde || Gigi', 'https://aprycot.media/blog/liebe-familie-liebe-freunde/' => 'Liebe Familie, liebe Freunde || Gigi',
'https://aprycot.media/?p=92629' => 'Magisches Internet-Geld || Gigi', 'https://aprycot.media/?p=92629' => 'Magisches Internet-Geld || Gigi',
'https://europeanbitcoiners.com/mises-der-urspruengliche-toxische-maximalist/' => 'Mises: der ursrpüngliche toxische Maximalist || Michael Goldstein', 'https://europeanbitcoiners.com/mises-der-urspruengliche-toxische-maximalist/' => 'Mises: der ursrpüngliche toxische Maximalist || Michael Goldstein',
'https://aprycot.media/blog/kolonialismus-und-bitcoin/' => 'Monetären Kolonialismus mit Open-Source-Code bekämpfen || Alex Gladstein', 'https://aprycot.media/blog/kolonialismus-und-bitcoin/' => 'Monetären Kolonialismus mit Open-Source-Code bekämpfen || Alex Gladstein',
'https://aprycot.media/blog/privatsphaere-in-bitcoin-bewaehrte-praktiken/' => 'Privatspähre in Bitcoin: Bewährte Praktiken || Gigi', 'https://aprycot.media/blog/privatsphaere-in-bitcoin-bewaehrte-praktiken/' => 'Privatspähre in Bitcoin: Bewährte Praktiken || Gigi',
'https://aprycot.media/blog/shelling-out-die-urspruenge-des-geldes/' => 'Shelling Out — Die Ursprünge des Geldes || Nick Szabo', 'https://aprycot.media/blog/shelling-out-die-urspruenge-des-geldes/' => 'Shelling Out — Die Ursprünge des Geldes || Nick Szabo',
'https://aprycot.media/blog/spekulative-attacken/' => 'Spekulative Attacken || Pierre Rochard', 'https://aprycot.media/blog/spekulative-attacken/' => 'Spekulative Attacken || Pierre Rochard',
'https://aprycot.media/blog/unveraeusserliche-eigentumsrechte-recht-sprache-geld-und-moral-||-bitcoin/' => 'Unveränderliche Eigentumsrechte - Recht, Sprache, Geld und Moral von Bitcoin || Gigi', 'https://aprycot.media/blog/unveraeusserliche-eigentumsrechte-recht-sprache-geld-und-moral-||-bitcoin/' => 'Unveränderliche Eigentumsrechte - Recht, Sprache, Geld und Moral von Bitcoin || Gigi',
'https://europeanbitcoiners.com/warum-bitcoin-gut-fur-die-umwelt-ist/' => 'Warum Bitcoin gut für die Umwelt ist || Leon A. Wankum', 'https://europeanbitcoiners.com/warum-bitcoin-gut-fur-die-umwelt-ist/' => 'Warum Bitcoin gut für die Umwelt ist || Leon A. Wankum',
'https://europeanbitcoiners.com/die-padagogik-von-bitcoin/' => 'Die Pädagogik von Bitcoin || Erik Cason', 'https://europeanbitcoiners.com/die-padagogik-von-bitcoin/' => 'Die Pädagogik von Bitcoin || Erik Cason',
'https://europeanbitcoiners.com/bitcoin-first-warum-anleger-bitcoin-getrennt-von-anderen-digitalen-vermogenswerten-betrachten-mussen/' => 'Bitcoin First: Warum Anleger Bitcoin getrennt von anderen digitalen Vermögenswerten betrachten müssen || Fidelity Digital Assets', 'https://europeanbitcoiners.com/bitcoin-first-warum-anleger-bitcoin-getrennt-von-anderen-digitalen-vermogenswerten-betrachten-mussen/' => 'Bitcoin First: Warum Anleger Bitcoin getrennt von anderen digitalen Vermögenswerten betrachten müssen || Fidelity Digital Assets',
'https://blockinfo.ch/bitcoin-brechen-das-prinzip-von-hartem-geld/' => 'Bitcoin brechen — Das Prinzip von hartem Geld || Ben Kaufman', 'https://blockinfo.ch/bitcoin-brechen-das-prinzip-von-hartem-geld/' => 'Bitcoin brechen — Das Prinzip von hartem Geld || Ben Kaufman',
]; ];
$library = Library::firstOrCreate(['name' => 'Bitcoin Lesestoff by Gigi'], ['created_by' => 1]); $library = Library::firstOrCreate(['name' => 'Bitcoin Lesestoff by Gigi'], ['created_by' => 1]);
foreach ($items as $link => $item) { foreach ($items as $link => $item) {
$name = str($item)->before(' || '); $name = str($item)->before(' || ');
$author = str($item)->after(' || '); $author = str($item)->after(' || ');
$contentCreator = Lecturer::firstOrCreate(['name' => $author], [ $contentCreator = Lecturer::firstOrCreate(['name' => $author], [
'name' => $author, 'name' => $author,
'created_by' => 1, 'created_by' => 1,
'team_id' => 1, 'team_id' => 1,
]); ]);
$libraryItem = LibraryItem::firstOrCreate(['name' => $name], [ $libraryItem = LibraryItem::firstOrCreate(['name' => $name], [
'lecturer_id' => $contentCreator->id, 'lecturer_id' => $contentCreator->id,
'type' => 'blog_article', 'type' => 'blog_article',
'language_code' => 'de', 'language_code' => 'de',
'value' => $link, 'value' => $link,
'created_by' => 1, 'created_by' => 1,
]); ]);
try { try {

View File

@@ -13,19 +13,17 @@ class Kernel extends ConsoleKernel
{ {
protected $commands = [ protected $commands = [
SyncOpenBooks::class, SyncOpenBooks::class,
ReadAndSyncPodcastFeeds::class ReadAndSyncPodcastFeeds::class,
]; ];
/** /**
* Define the application's command schedule. * Define the application's command schedule.
* *
* @param \Illuminate\Console\Scheduling\Schedule $schedule * @param \Illuminate\Console\Scheduling\Schedule $schedule
*
* @return void * @return void
*/ */
protected function schedule(Schedule $schedule) protected function schedule(Schedule $schedule)
{ {
$schedule->call(new PruneStaleAttachments) $schedule->call(new PruneStaleAttachments)
->daily(); ->daily();
$schedule->command(SyncOpenBooks::class) $schedule->command(SyncOpenBooks::class)
@@ -38,6 +36,7 @@ class Kernel extends ConsoleKernel
/** /**
* Register the commands for the application. * Register the commands for the application.
*
* @return void * @return void
*/ */
protected function commands() protected function commands()

View File

@@ -26,28 +26,28 @@ enum LibraryItemType: string
public static function labels(): array public static function labels(): array
{ {
return [ return [
'book' => __('Book'), 'book' => __('Book'),
'blog_article' => __('Article'), 'blog_article' => __('Article'),
'markdown_article' => __('Markdown Article'), 'markdown_article' => __('Markdown Article'),
'markdown_article_extern' => __('Markdown Article Extern'), 'markdown_article_extern' => __('Markdown Article Extern'),
'youtube_video' => __('Youtube Video'), 'youtube_video' => __('Youtube Video'),
'vimeo_video' => __('Vimeo Video'), 'vimeo_video' => __('Vimeo Video'),
'podcast_episode' => __('Podcast Episode'), 'podcast_episode' => __('Podcast Episode'),
'downloadable_file' => __('Downloadable File'), 'downloadable_file' => __('Downloadable File'),
]; ];
} }
public static function icons(): array public static function icons(): array
{ {
return [ return [
'book' => 'book', 'book' => 'book',
'blog_article' => 'newspaper', 'blog_article' => 'newspaper',
'markdown_article' => 'newspaper', 'markdown_article' => 'newspaper',
'markdown_article_extern' => 'newspaper', 'markdown_article_extern' => 'newspaper',
'youtube_video' => 'video', 'youtube_video' => 'video',
'vimeo_video' => 'video', 'vimeo_video' => 'video',
'podcast_episode' => 'podcast', 'podcast_episode' => 'podcast',
'downloadable_file' => 'download', 'downloadable_file' => 'download',
]; ];
} }
} }

View File

@@ -14,6 +14,7 @@ class ChatMessageSentEvent implements ShouldBroadcast
/** /**
* Create a new event instance. * Create a new event instance.
*
* @return void * @return void
*/ */
public function __construct() public function __construct()
@@ -23,6 +24,7 @@ class ChatMessageSentEvent implements ShouldBroadcast
/** /**
* Get the channels the event should broadcast on. * Get the channels the event should broadcast on.
*
* @return \Illuminate\Broadcasting\Channel|array * @return \Illuminate\Broadcasting\Channel|array
*/ */
public function broadcastOn() public function broadcastOn()

View File

@@ -14,6 +14,7 @@ class PlebLoggedInEvent implements ShouldBroadcast
/** /**
* Create a new event instance. * Create a new event instance.
*
* @return void * @return void
*/ */
public function __construct(public string $name, public string $img) public function __construct(public string $name, public string $img)
@@ -23,6 +24,7 @@ class PlebLoggedInEvent implements ShouldBroadcast
/** /**
* Get the channels the event should broadcast on. * Get the channels the event should broadcast on.
*
* @return \Illuminate\Broadcasting\Channel|array * @return \Illuminate\Broadcasting\Channel|array
*/ */
public function broadcastOn() public function broadcastOn()

View File

@@ -12,6 +12,7 @@ class BookCaseOrangePilled extends PointType
/** /**
* Number of points * Number of points
*
* @var int * @var int
*/ */
public $points = 210; public $points = 210;
@@ -28,6 +29,7 @@ class BookCaseOrangePilled extends PointType
/** /**
* User who will be receive points * User who will be receive points
*
* @return mixed * @return mixed
*/ */
public function payee() public function payee()

View File

@@ -12,6 +12,7 @@ class LanguageController extends Controller
{ {
/** /**
* Display a listing of the resource. * Display a listing of the resource.
*
* @return \Illuminate\Http\JsonResponse * @return \Illuminate\Http\JsonResponse
*/ */
public function index(Request $request) public function index(Request $request)
@@ -21,14 +22,14 @@ class LanguageController extends Controller
->orderBy('name') ->orderBy('name')
->when( ->when(
$request->search, $request->search,
fn(Builder $query) => $query fn (Builder $query) => $query
->where('name', 'ilike', "%{$request->search}%") ->where('name', 'ilike', "%{$request->search}%")
->orWhere('language', 'ilike', "%{$request->search}%") ->orWhere('language', 'ilike', "%{$request->search}%")
) )
->when( ->when(
$request->exists('selected'), $request->exists('selected'),
fn(Builder $query) => $query->whereIn('language', $request->input('selected', [])), fn (Builder $query) => $query->whereIn('language', $request->input('selected', [])),
fn(Builder $query) => $query->limit(10) fn (Builder $query) => $query->limit(10)
) )
->get() ->get()
->map(function ($language) { ->map(function ($language) {
@@ -40,6 +41,7 @@ class LanguageController extends Controller
$language->toTranslate = Translation::query() $language->toTranslate = Translation::query()
->where('language_id', $language['id']) ->where('language_id', $language['id'])
->count(); ->count();
return $language; return $language;
}) })
->toArray(); ->toArray();
@@ -60,7 +62,6 @@ class LanguageController extends Controller
* Store a newly created resource in storage. * Store a newly created resource in storage.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function store(Request $request) public function store(Request $request)
@@ -71,8 +72,7 @@ class LanguageController extends Controller
/** /**
* Display the specified resource. * Display the specified resource.
* *
* @param $language * @param $language
*
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function show(Language $language) public function show(Language $language)
@@ -84,8 +84,7 @@ class LanguageController extends Controller
* Update the specified resource in storage. * Update the specified resource in storage.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param $language * @param $language
*
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function update(Request $request, Language $language) public function update(Request $request, Language $language)
@@ -96,8 +95,7 @@ class LanguageController extends Controller
/** /**
* Remove the specified resource from storage. * Remove the specified resource from storage.
* *
* @param $language * @param $language
*
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function destroy(Language $language) public function destroy(Language $language)

View File

@@ -11,26 +11,26 @@ class LecturerController extends Controller
{ {
/** /**
* Display a listing of the resource. * Display a listing of the resource.
*
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function index(Request $request) public function index(Request $request)
{ {
return Lecturer::query() return Lecturer::query()
->select('id', 'name',) ->select('id', 'name', )
->orderBy('name') ->orderBy('name')
// ->when($request->has('user_id'), // ->when($request->has('user_id'),
// fn(Builder $query) => $query->where('created_by', $request->user_id)) // fn(Builder $query) => $query->where('created_by', $request->user_id))
->when( ->when(
$request->search, $request->search,
fn(Builder $query) => $query fn (Builder $query) => $query
->where('name', 'ilike', "%{$request->search}%") ->where('name', 'ilike', "%{$request->search}%")
) )
->when( ->when(
$request->exists('selected'), $request->exists('selected'),
fn(Builder $query) => $query->whereIn('id', fn (Builder $query) => $query->whereIn('id',
$request->input('selected', [])), $request->input('selected', [])),
fn(Builder $query) => $query->limit(10) fn (Builder $query) => $query->limit(10)
) )
->get() ->get()
->map(function (Lecturer $lecturer) { ->map(function (Lecturer $lecturer) {
@@ -45,7 +45,6 @@ class LecturerController extends Controller
* Store a newly created resource in storage. * Store a newly created resource in storage.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function store(Request $request) public function store(Request $request)
@@ -57,7 +56,6 @@ class LecturerController extends Controller
* Display the specified resource. * Display the specified resource.
* *
* @param \App\Models\Lecturer $lecturer * @param \App\Models\Lecturer $lecturer
*
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function show(Lecturer $lecturer) public function show(Lecturer $lecturer)
@@ -70,7 +68,6 @@ class LecturerController extends Controller
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \App\Models\Lecturer $lecturer * @param \App\Models\Lecturer $lecturer
*
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function update(Request $request, Lecturer $lecturer) public function update(Request $request, Lecturer $lecturer)
@@ -82,7 +79,6 @@ class LecturerController extends Controller
* Remove the specified resource from storage. * Remove the specified resource from storage.
* *
* @param \App\Models\Lecturer $lecturer * @param \App\Models\Lecturer $lecturer
*
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function destroy(Lecturer $lecturer) public function destroy(Lecturer $lecturer)

View File

@@ -12,6 +12,7 @@ class MeetupController extends Controller
{ {
/** /**
* Display a listing of the resource. * Display a listing of the resource.
*
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function index(Request $request) public function index(Request $request)
@@ -27,15 +28,15 @@ class MeetupController extends Controller
->orderBy('name') ->orderBy('name')
->when( ->when(
$request->search, $request->search,
fn(Builder $query) => $query fn (Builder $query) => $query
->where('name', 'like', "%{$request->search}%") ->where('name', 'like', "%{$request->search}%")
->orWhereHas('city', ->orWhereHas('city',
fn(Builder $query) => $query->where('cities.name', 'ilike', "%{$request->search}%")) fn (Builder $query) => $query->where('cities.name', 'ilike', "%{$request->search}%"))
) )
->when( ->when(
$request->exists('selected'), $request->exists('selected'),
fn(Builder $query) => $query->whereIn('id', $request->input('selected', [])), fn (Builder $query) => $query->whereIn('id', $request->input('selected', [])),
fn(Builder $query) => $query->limit(10) fn (Builder $query) => $query->limit(10)
) )
->get() ->get()
->map(function (Meetup $meetup) { ->map(function (Meetup $meetup) {
@@ -49,7 +50,6 @@ class MeetupController extends Controller
* Store a newly created resource in storage. * Store a newly created resource in storage.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function store(Request $request) public function store(Request $request)
@@ -61,7 +61,6 @@ class MeetupController extends Controller
* Display the specified resource. * Display the specified resource.
* *
* @param \App\Models\meetup $meetup * @param \App\Models\meetup $meetup
*
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function show(meetup $meetup) public function show(meetup $meetup)
@@ -74,7 +73,6 @@ class MeetupController extends Controller
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \App\Models\meetup $meetup * @param \App\Models\meetup $meetup
*
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function update(Request $request, meetup $meetup) public function update(Request $request, meetup $meetup)
@@ -86,7 +84,6 @@ class MeetupController extends Controller
* Remove the specified resource from storage. * Remove the specified resource from storage.
* *
* @param \App\Models\meetup $meetup * @param \App\Models\meetup $meetup
*
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function destroy(meetup $meetup) public function destroy(meetup $meetup)

View File

@@ -13,7 +13,6 @@ class DownloadBitcoinEventCalendar extends Controller
* Handle the incoming request. * Handle the incoming request.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function __invoke(Request $request) public function __invoke(Request $request)

View File

@@ -14,7 +14,6 @@ class DownloadMeetupCalendar extends Controller
* Handle the incoming request. * Handle the incoming request.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function __invoke(Request $request) public function __invoke(Request $request)

View File

@@ -12,17 +12,16 @@ class ImageController extends Controller
* Handle the incoming request. * Handle the incoming request.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function __invoke(Filesystem $filesystem, $path) public function __invoke(Filesystem $filesystem, $path)
{ {
$server = ServerFactory::create([ $server = ServerFactory::create([
'response' => new LaravelResponseFactory(app('request')), 'response' => new LaravelResponseFactory(app('request')),
'source' => $filesystem->getDriver(), 'source' => $filesystem->getDriver(),
'cache' => $filesystem->getDriver(), 'cache' => $filesystem->getDriver(),
'cache_path_prefix' => '.cache', 'cache_path_prefix' => '.cache',
'base_url' => 'img', 'base_url' => 'img',
]); ]);
return $server->getImageResponse('public/'.$path, request()->all()); return $server->getImageResponse('public/'.$path, request()->all());

View File

@@ -13,6 +13,7 @@ class Kernel extends HttpKernel
/** /**
* The application's global HTTP middleware stack. * The application's global HTTP middleware stack.
* These middleware are run during every request to your application. * These middleware are run during every request to your application.
*
* @var array<int, class-string|string> * @var array<int, class-string|string>
*/ */
protected $middleware = [ protected $middleware = [
@@ -27,6 +28,7 @@ class Kernel extends HttpKernel
/** /**
* The application's route middleware groups. * The application's route middleware groups.
*
* @var array<string, array<int, class-string|string>> * @var array<string, array<int, class-string|string>>
*/ */
protected $middlewareGroups = [ protected $middlewareGroups = [
@@ -72,19 +74,20 @@ class Kernel extends HttpKernel
/** /**
* The application's route middleware. * The application's route middleware.
* These middleware may be assigned to groups or used individually. * These middleware may be assigned to groups or used individually.
*
* @var array<string, class-string|string> * @var array<string, class-string|string>
*/ */
protected $routeMiddleware = [ protected $routeMiddleware = [
'auth' => \App\Http\Middleware\Authenticate::class, 'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class, 'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class, 'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'signed' => \App\Http\Middleware\ValidateSignature::class, 'signed' => \App\Http\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => CustomEnsureEmailVerified::class, 'verified' => CustomEnsureEmailVerified::class,
'needMeetup' => NeedMeetupMiddleware::class, 'needMeetup' => NeedMeetupMiddleware::class,
]; ];
} }

View File

@@ -8,6 +8,7 @@ use SimpleSoftwareIO\QrCode\Facades\QrCode;
class Auth47Component extends Component class Auth47Component extends Component
{ {
public ?string $k1 = null; public ?string $k1 = null;
protected ?string $url = null; protected ?string $url = null;
public function mount() public function mount()

View File

@@ -12,8 +12,11 @@ use SimpleSoftwareIO\QrCode\Facades\QrCode;
class LNUrlAuth extends Component class LNUrlAuth extends Component
{ {
public ?string $k1 = null; public ?string $k1 = null;
protected ?string $url = null; protected ?string $url = null;
protected ?string $lnurl = null; protected ?string $lnurl = null;
protected ?string $qrCode = null; protected ?string $qrCode = null;
public function switchToEmailLogin() public function switchToEmailLogin()

View File

@@ -17,7 +17,7 @@ class BitcoinEventTable extends Component
public function mount() public function mount()
{ {
if (!$this->year) { if (! $this->year) {
$this->year = now()->year; $this->year = now()->year;
} }
} }
@@ -30,30 +30,30 @@ class BitcoinEventTable extends Component
'venue.city.country', 'venue.city.country',
]) ])
->where('bitcoin_events.from', '>=', now()) ->where('bitcoin_events.from', '>=', now())
->where(fn($query) => $query ->where(fn ($query) => $query
->whereHas('venue.city.country', ->whereHas('venue.city.country',
fn($query) => $query->where('countries.code', $this->country->code)) fn ($query) => $query->where('countries.code', $this->country->code))
->orWhere('show_worldwide', true) ->orWhere('show_worldwide', true)
) )
->get() ->get()
->map(fn($event) => [ ->map(fn ($event) => [
'id' => $event->id, 'id' => $event->id,
'name' => $event->title, 'name' => $event->title,
'coords' => [$event->venue->city->latitude, $event->venue->city->longitude], 'coords' => [$event->venue->city->latitude, $event->venue->city->longitude],
]), ]),
'events' => BitcoinEvent::query() 'events' => BitcoinEvent::query()
->where('bitcoin_events.from', '>=', now()) ->where('bitcoin_events.from', '>=', now())
->where(fn($query) => $query ->where(fn ($query) => $query
->whereHas('venue.city.country', ->whereHas('venue.city.country',
fn($query) => $query->where('countries.code', $this->country->code)) fn ($query) => $query->where('countries.code', $this->country->code))
->orWhere('show_worldwide', true) ->orWhere('show_worldwide', true)
) )
->get() ->get()
->map(fn($event) => [ ->map(fn ($event) => [
'id' => $event->id, 'id' => $event->id,
'startDate' => $event->from, 'startDate' => $event->from,
'endDate' => $event->to, 'endDate' => $event->to,
'location' => $event->title, 'location' => $event->title,
'description' => $event->description, 'description' => $event->description,
]), ]),
])->layout('layouts.app', [ ])->layout('layouts.app', [
@@ -61,7 +61,7 @@ class BitcoinEventTable extends Component
title: __('Bitcoin Events'), title: __('Bitcoin Events'),
description: __('Search out a Bitcoin Event'), description: __('Search out a Bitcoin Event'),
image: asset('img/screenshot.png') image: asset('img/screenshot.png')
) ),
]); ]);
} }
@@ -69,13 +69,13 @@ class BitcoinEventTable extends Component
{ {
return to_route('bitcoinEvent.table.bitcoinEvent', [ return to_route('bitcoinEvent.table.bitcoinEvent', [
'#table', '#table',
'country' => $this->country->code, 'country' => $this->country->code,
'year' => $this->year, 'year' => $this->year,
'bitcoin_events' => [ 'bitcoin_events' => [
'filters' => [ 'filters' => [
'byid' => $id, 'byid' => $id,
], ],
] ],
]); ]);
} }
@@ -83,13 +83,13 @@ class BitcoinEventTable extends Component
{ {
return to_route('bitcoinEvent.table.bitcoinEvent', [ return to_route('bitcoinEvent.table.bitcoinEvent', [
'#table', '#table',
'country' => $this->country->code, 'country' => $this->country->code,
'year' => $this->year, 'year' => $this->year,
'bitcoin_events' => [ 'bitcoin_events' => [
'filters' => [ 'filters' => [
'byid' => $ids, 'byid' => $ids,
] ],
] ],
]); ]);
} }
} }

View File

@@ -10,7 +10,9 @@ use RalphJSmit\Laravel\SEO\Support\SEOData;
class BookCaseTable extends Component class BookCaseTable extends Component
{ {
public ?Country $country = null; public ?Country $country = null;
public string $c = 'de'; public string $c = 'de';
public array $bookcases = []; public array $bookcases = [];
protected $queryString = ['bookcases']; protected $queryString = ['bookcases'];
@@ -18,16 +20,16 @@ class BookCaseTable extends Component
public function render() public function render()
{ {
return view('livewire.book-case.book-case-table', [ return view('livewire.book-case.book-case-table', [
'markers' => !isset($this->table['filters']['byids']) ? [] 'markers' => ! isset($this->table['filters']['byids']) ? []
: BookCase::query() : BookCase::query()
->whereIn('id', str($this->table['filters']['byids'] ?? '')->explode(',')) ->whereIn('id', str($this->table['filters']['byids'] ?? '')->explode(','))
->get() ->get()
->map(fn($b) => [ ->map(fn ($b) => [
'title' => $b->title, 'title' => $b->title,
'lat' => $b->latitude, 'lat' => $b->latitude,
'lng' => $b->longitude, 'lng' => $b->longitude,
'url' => route('bookCases.comment.bookcase', ['country' => $this->country, 'bookCase' => $b]), 'url' => route('bookCases.comment.bookcase', ['country' => $this->country, 'bookCase' => $b]),
'icon' => asset('img/btc-logo-6219386_1280.png'), 'icon' => asset('img/btc-logo-6219386_1280.png'),
'icon_size' => [42, 42], 'icon_size' => [42, 42],
]) ])
->toArray(), ->toArray(),
@@ -40,7 +42,7 @@ class BookCaseTable extends Component
title: __('Bookcases'), title: __('Bookcases'),
description: __('Search out a public bookcase'), description: __('Search out a public bookcase'),
image: asset('img/screenshot.png') image: asset('img/screenshot.png')
) ),
]); ]);
} }
} }

View File

@@ -17,7 +17,7 @@ class CityTable extends Component
title: __('Bookcases'), title: __('Bookcases'),
description: __('Search out a public bookcase'), description: __('Search out a public bookcase'),
image: asset('img/screenshot.png') image: asset('img/screenshot.png')
) ),
]); ]);
} }
} }

View File

@@ -21,8 +21,6 @@ class CommentBookCase extends Component
public BookCase $bookCase; public BookCase $bookCase;
public function render() public function render()
{ {
return view('livewire.book-case.comment-book-case') return view('livewire.book-case.comment-book-case')
@@ -31,7 +29,7 @@ class CommentBookCase extends Component
title: $this->bookCase->title, title: $this->bookCase->title,
description: $this->bookCase->address, description: $this->bookCase->address,
image: $this->bookCase->getFirstMediaUrl('images') ?? asset('img/bookcase.jpg'), image: $this->bookCase->getFirstMediaUrl('images') ?? asset('img/bookcase.jpg'),
) ),
]); ]);
} }
@@ -43,7 +41,7 @@ class CommentBookCase extends Component
$this->bookCase $this->bookCase
->addMedia($this->photo) ->addMedia($this->photo)
->usingFileName(md5($this->photo->getClientOriginalName()) . '.' . $this->photo->getClientOriginalExtension()) ->usingFileName(md5($this->photo->getClientOriginalName()).'.'.$this->photo->getClientOriginalExtension())
->toMediaCollection('images'); ->toMediaCollection('images');
return to_route('bookCases.comment.bookcase', ['country' => $this->country, 'bookCase' => $this->bookCase->id]); return to_route('bookCases.comment.bookcase', ['country' => $this->country, 'bookCase' => $this->bookCase->id]);
@@ -62,7 +60,7 @@ class CommentBookCase extends Component
if (str($url)->contains('http')) { if (str($url)->contains('http')) {
return $url; return $url;
} }
if (!str($url)->contains('http')) { if (! str($url)->contains('http')) {
return str($url)->prepend('https://'); return str($url)->prepend('https://');
} }
} }

View File

@@ -15,6 +15,7 @@ class OrangePillForm extends Component
public Country $country; public Country $country;
public BookCase $bookCase; public BookCase $bookCase;
public ?OrangePill $orangePill = null; public ?OrangePill $orangePill = null;
public $image; public $image;
@@ -27,22 +28,22 @@ class OrangePillForm extends Component
{ {
return [ return [
'orangePill.book_case_id' => 'required', 'orangePill.book_case_id' => 'required',
'orangePill.user_id' => 'required', 'orangePill.user_id' => 'required',
'orangePill.amount' => 'required|numeric', 'orangePill.amount' => 'required|numeric',
'orangePill.date' => 'required|date', 'orangePill.date' => 'required|date',
'orangePill.comment' => 'required|string', 'orangePill.comment' => 'required|string',
'image' => 'image|max:8192', // 8MB Max 'image' => 'image|max:8192', // 8MB Max
]; ];
} }
public function mount() public function mount()
{ {
if (!$this->orangePill) { if (! $this->orangePill) {
$this->orangePill = new OrangePill([ $this->orangePill = new OrangePill([
'user_id' => auth()->id(), 'user_id' => auth()->id(),
'book_case_id' => $this->bookCase->id, 'book_case_id' => $this->bookCase->id,
'date' => now(), 'date' => now(),
'amount' => 1, 'amount' => 1,
]); ]);
} elseif ($this->orangePill->user_id !== auth()->id()) { } elseif ($this->orangePill->user_id !== auth()->id()) {
abort(403); abort(403);

View File

@@ -16,7 +16,7 @@ class Heatmap extends Component
->active() ->active()
->whereHas('orangePills') ->whereHas('orangePills')
->get() ->get()
->map(fn($bookCase) => [ ->map(fn ($bookCase) => [
'lat' => $bookCase->latitude, 'lat' => $bookCase->latitude,
'lng' => $bookCase->longitude, 'lng' => $bookCase->longitude,
]); ]);
@@ -28,7 +28,7 @@ class Heatmap extends Component
title: __('Heatmap of Bookcases'), title: __('Heatmap of Bookcases'),
description: __('On this map you can see the success and spread of the Bitcoin books.'), description: __('On this map you can see the success and spread of the Bitcoin books.'),
image: asset('img/heatmap_bookcases.png'), image: asset('img/heatmap_bookcases.png'),
) ),
]); ]);
} }
} }

View File

@@ -10,7 +10,9 @@ use RalphJSmit\Laravel\SEO\Support\SEOData;
class HighscoreTable extends Component class HighscoreTable extends Component
{ {
public Country $country; public Country $country;
public bool $viewingModal = false; public bool $viewingModal = false;
public ?User $modal = null; public ?User $modal = null;
public function render() public function render()
@@ -31,7 +33,7 @@ class HighscoreTable extends Component
title: __('Highscore Table'), title: __('Highscore Table'),
description: __('Hall of fame of our honorable plebs'), description: __('Hall of fame of our honorable plebs'),
image: asset('img/highscore_table_screenshot.png'), image: asset('img/highscore_table_screenshot.png'),
) ),
]); ]);
} }

View File

@@ -19,15 +19,15 @@ class WorldMap extends Component
->withCount('orangePills') ->withCount('orangePills')
->active() ->active()
->get() ->get()
->map(fn($bookCase) => [ ->map(fn ($bookCase) => [
'lat' => $bookCase->latitude, 'lat' => $bookCase->latitude,
'lng' => $bookCase->longitude, 'lng' => $bookCase->longitude,
'url' => url()->route('bookCases.comment.bookcase', 'url' => url()->route('bookCases.comment.bookcase',
[ [
'country' => $this->country, 'country' => $this->country,
'bookCase' => $bookCase, 'bookCase' => $bookCase,
]), ]),
'op' => $bookCase->orange_pills_count, 'op' => $bookCase->orange_pills_count,
]) ])
->toArray(), ->toArray(),
])->layout('layouts.app', [ ])->layout('layouts.app', [
@@ -35,7 +35,7 @@ class WorldMap extends Component
title: __('World Map of Bookcases'), 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.'), 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') image: asset('img/world_map_bookcases.png')
) ),
]); ]);
} }
} }

View File

@@ -10,6 +10,7 @@ class HighscoreChat extends Component
public bool $open = false; public bool $open = false;
public array $messages = []; public array $messages = [];
public string $myNewMessage = ''; public string $myNewMessage = '';
public function rules() public function rules()
@@ -22,7 +23,7 @@ class HighscoreChat extends Component
public function getListeners() public function getListeners()
{ {
return [ return [
'toggleHighscoreChat' => 'toggle', 'toggleHighscoreChat' => 'toggle',
'echo:plebchannel,.App\Events\ChatMessageSentEvent' => 'chatMessageSent', 'echo:plebchannel,.App\Events\ChatMessageSentEvent' => 'chatMessageSent',
]; ];
} }
@@ -34,7 +35,7 @@ class HighscoreChat extends Component
public function toggle() public function toggle()
{ {
$this->open = !$this->open; $this->open = ! $this->open;
} }
public function chatMessageSent() public function chatMessageSent()
@@ -50,11 +51,11 @@ class HighscoreChat extends Component
$this->validate(); $this->validate();
$newMessages = collect(cache()->get('highscore_chat_messages', [])) $newMessages = collect(cache()->get('highscore_chat_messages', []))
->push([ ->push([
'fromId' => auth()->id(), 'fromId' => auth()->id(),
'fromName' => str(auth()->user()->name)->limit(2), 'fromName' => str(auth()->user()->name)->limit(2),
'userImg' => str(auth()->user()->profile_photo_url)->replace('background=EBF4FF', 'background=F7931A'), 'userImg' => str(auth()->user()->profile_photo_url)->replace('background=EBF4FF', 'background=F7931A'),
'message' => $this->myNewMessage, 'message' => $this->myNewMessage,
'time' => now()->asDateTime(), 'time' => now()->asDateTime(),
]) ])
->take(-21) ->take(-21)
->toArray(); ->toArray();

View File

@@ -21,18 +21,18 @@ class CityForm extends Component
{ {
return [ return [
'city.country_id' => 'required', 'city.country_id' => 'required',
'city.name' => 'required|string', 'city.name' => 'required|string',
'city.longitude' => 'required', 'city.longitude' => 'required',
'city.latitude' => 'required', 'city.latitude' => 'required',
]; ];
} }
public function mount() public function mount()
{ {
if (!$this->city) { if (! $this->city) {
$this->city = new City(); $this->city = new City();
} }
if (!$this->fromUrl) { if (! $this->fromUrl) {
$this->fromUrl = url()->previous(); $this->fromUrl = url()->previous();
} }
} }

View File

@@ -12,6 +12,7 @@ class ContentCreatorForm extends Component
use WithFileUploads; use WithFileUploads;
public ?Lecturer $lecturer = null; public ?Lecturer $lecturer = null;
public $image; public $image;
public ?string $fromUrl = ''; public ?string $fromUrl = '';
@@ -21,30 +22,30 @@ class ContentCreatorForm extends Component
public function rules() public function rules()
{ {
return [ return [
'image' => [Rule::requiredIf(!$this->lecturer->id), 'nullable', 'mimes:jpeg,png,jpg,gif', 'max:10240'], 'image' => [Rule::requiredIf(! $this->lecturer->id), 'nullable', 'mimes:jpeg,png,jpg,gif', 'max:10240'],
'lecturer.name' => 'required', 'lecturer.name' => 'required',
'lecturer.active' => 'boolean', 'lecturer.active' => 'boolean',
'lecturer.subtitle' => 'required', 'lecturer.subtitle' => 'required',
'lecturer.intro' => 'required', 'lecturer.intro' => 'required',
'lecturer.twitter_username' => 'nullable|string', 'lecturer.twitter_username' => 'nullable|string',
'lecturer.website' => 'nullable|url', 'lecturer.website' => 'nullable|url',
'lecturer.lightning_address' => 'nullable|string', 'lecturer.lightning_address' => 'nullable|string',
'lecturer.lnurl' => 'nullable|string', 'lecturer.lnurl' => 'nullable|string',
'lecturer.node_id' => 'nullable|string', 'lecturer.node_id' => 'nullable|string',
]; ];
} }
public function mount() public function mount()
{ {
if (!$this->lecturer) { if (! $this->lecturer) {
$this->lecturer = new Lecturer([ $this->lecturer = new Lecturer([
'intro' => '', 'intro' => '',
'active' => true, 'active' => true,
'team_id' => true, 'team_id' => true,
]); ]);
} }
if (!$this->fromUrl) { if (! $this->fromUrl) {
$this->fromUrl = url()->previous(); $this->fromUrl = url()->previous();
} }
} }

View File

@@ -26,7 +26,7 @@ class Footer extends Component
return view('livewire.frontend.footer', [ return view('livewire.frontend.footer', [
'percentTranslated' => $l === 'en' ? 100 : round(($translated / $toTranslate) * 100), 'percentTranslated' => $l === 'en' ? 100 : round(($translated / $toTranslate) * 100),
'language' => $language, 'language' => $language,
]); ]);
} }
} }

View File

@@ -11,8 +11,11 @@ use Livewire\Component;
class Header extends Component class Header extends Component
{ {
public ?Country $country = null; public ?Country $country = null;
public $currentRouteName; public $currentRouteName;
public string $c = 'de'; public string $c = 'de';
public string $l = 'de'; public string $l = 'de';
public $bgColor = 'bg-21gray'; public $bgColor = 'bg-21gray';
@@ -30,7 +33,7 @@ class Header extends Component
public function mount() public function mount()
{ {
$this->l = Cookie::get('lang') ?: config('app.locale'); $this->l = Cookie::get('lang') ?: config('app.locale');
if (!$this->country) { if (! $this->country) {
$this->country = Country::query() $this->country = Country::query()
->where('code', $this->c) ->where('code', $this->c)
->first(); ->first();
@@ -56,7 +59,7 @@ class Header extends Component
Cookie::queue('lang', $this->l, 60 * 24 * 365); Cookie::queue('lang', $this->l, 60 * 24 * 365);
return view('livewire.frontend.header', [ return view('livewire.frontend.header', [
'cities' => City::query() 'cities' => City::query()
->select(['latitude', 'longitude']) ->select(['latitude', 'longitude'])
->get(), ->get(),
'countries' => Country::query() 'countries' => Country::query()

View File

@@ -10,9 +10,10 @@ use RalphJSmit\Laravel\SEO\Support\SEOData;
class Welcome extends Component class Welcome extends Component
{ {
public string $c = 'de'; public string $c = 'de';
public string $l = 'de'; public string $l = 'de';
protected $queryString = ['c','l']; protected $queryString = ['c', 'l'];
public function rules() public function rules()
{ {
@@ -67,7 +68,7 @@ class Welcome extends Component
title: __('Welcome'), title: __('Welcome'),
description: __('Welcome to the portal of the Einundzwanzig Community.'), description: __('Welcome to the portal of the Einundzwanzig Community.'),
image: asset('img/screenshot.png') image: asset('img/screenshot.png')
) ),
]); ]);
} }
} }

View File

@@ -16,14 +16,14 @@ class LaravelEcho extends Component
if (auth()->check()) { if (auth()->check()) {
$this->notification() $this->notification()
->confirm([ ->confirm([
'img' => $data['img'], 'img' => $data['img'],
'title' => 'Pleb alert!', 'title' => 'Pleb alert!',
'description' => $data['name'].' logged in', 'description' => $data['name'].' logged in',
'icon' => 'bell', 'icon' => 'bell',
'acceptLabel' => '', 'acceptLabel' => '',
'rejectLabel' => '', 'rejectLabel' => '',
'iconColor' => 'primary', 'iconColor' => 'primary',
'timeout' => 60000, 'timeout' => 60000,
]); ]);
} }
} }

View File

@@ -19,53 +19,58 @@ class LibraryItemForm extends Component
public Country $country; public Country $country;
public ?LibraryItem $libraryItem = null; public ?LibraryItem $libraryItem = null;
public $library; public $library;
public $image; public $image;
public $file; public $file;
public array $selectedTags = []; public array $selectedTags = [];
public bool $lecturer = false; public bool $lecturer = false;
public ?string $fromUrl = ''; public ?string $fromUrl = '';
protected $queryString = [ protected $queryString = [
'fromUrl' => ['except' => ''], 'fromUrl' => ['except' => ''],
'lecturer' => ['except' => false], 'lecturer' => ['except' => false],
]; ];
public function rules() public function rules()
{ {
return [ return [
'image' => [Rule::requiredIf(!$this->libraryItem->id), 'nullable', 'mimes:jpeg,png,jpg,gif', 'max:10240'], 'image' => [Rule::requiredIf(! $this->libraryItem->id), 'nullable', 'mimes:jpeg,png,jpg,gif', 'max:10240'],
'library' => 'required', 'library' => 'required',
'selectedTags' => 'array|min:1', 'selectedTags' => 'array|min:1',
'libraryItem.lecturer_id' => 'required', 'libraryItem.lecturer_id' => 'required',
'libraryItem.name' => 'required', 'libraryItem.name' => 'required',
'libraryItem.type' => 'required', 'libraryItem.type' => 'required',
'libraryItem.language_code' => 'required', 'libraryItem.language_code' => 'required',
'libraryItem.value' => [ 'libraryItem.value' => [
'required', 'required',
Rule::when( Rule::when(
$this->libraryItem->type !== LibraryItemType::MarkdownArticle $this->libraryItem->type !== LibraryItemType::MarkdownArticle
&& $this->libraryItem->type !== LibraryItemType::MarkdownArticleExtern && $this->libraryItem->type !== LibraryItemType::MarkdownArticleExtern
&& $this->libraryItem->type !== LibraryItemType::DownloadableFile, ['url'] && $this->libraryItem->type !== LibraryItemType::DownloadableFile, ['url']
) ),
], ],
'libraryItem.subtitle' => 'required', 'libraryItem.subtitle' => 'required',
'libraryItem.excerpt' => 'required', 'libraryItem.excerpt' => 'required',
'libraryItem.main_image_caption' => 'required', 'libraryItem.main_image_caption' => 'required',
'libraryItem.read_time' => 'required', 'libraryItem.read_time' => 'required',
'libraryItem.approved' => 'boolean', 'libraryItem.approved' => 'boolean',
]; ];
} }
public function mount() public function mount()
{ {
if (!$this->libraryItem) { if (! $this->libraryItem) {
$this->libraryItem = new LibraryItem([ $this->libraryItem = new LibraryItem([
'approved' => true, 'approved' => true,
'read_time' => 1, 'read_time' => 1,
]); ]);
if ($this->lecturer) { if ($this->lecturer) {
@@ -76,13 +81,13 @@ class LibraryItemForm extends Component
$this->selectedTags = $this->libraryItem->tags() $this->selectedTags = $this->libraryItem->tags()
->where('type', 'library_item') ->where('type', 'library_item')
->get() ->get()
->map(fn($tag) => $tag->name) ->map(fn ($tag) => $tag->name)
->toArray(); ->toArray();
$this->library = $this->libraryItem->libraries() $this->library = $this->libraryItem->libraries()
->first() ->first()
->id; ->id;
} }
if (!$this->fromUrl) { if (! $this->fromUrl) {
$this->fromUrl = url()->previous(); $this->fromUrl = url()->previous();
} }
} }
@@ -118,7 +123,7 @@ class LibraryItemForm extends Component
{ {
$selectedTags = collect($this->selectedTags); $selectedTags = collect($this->selectedTags);
if ($selectedTags->contains($name)) { if ($selectedTags->contains($name)) {
$selectedTags = $selectedTags->filter(fn($tag) => $tag !== $name); $selectedTags = $selectedTags->filter(fn ($tag) => $tag !== $name);
} else { } else {
$selectedTags->push($name); $selectedTags->push($name);
} }
@@ -129,21 +134,21 @@ class LibraryItemForm extends Component
public function render() public function render()
{ {
return view('livewire.library.form.library-item-form', [ return view('livewire.library.form.library-item-form', [
'types' => Options::forEnum(LibraryItemType::class) 'types' => Options::forEnum(LibraryItemType::class)
->filter( ->filter(
fn($type) => $type !== LibraryItemType::PodcastEpisode fn ($type) => $type !== LibraryItemType::PodcastEpisode
&& $type !== LibraryItemType::MarkdownArticle && $type !== LibraryItemType::MarkdownArticle
) )
->toArray(), ->toArray(),
'libraries' => Library::query() 'libraries' => Library::query()
->where('is_public', true) ->where('is_public', true)
->get() ->get()
->map(fn($library) => [ ->map(fn ($library) => [
'id' => $library->id, 'id' => $library->id,
'name' => $library->name, 'name' => $library->name,
]) ])
->toArray(), ->toArray(),
'tags' => Tag::query() 'tags' => Tag::query()
->where('type', 'library_item') ->where('type', 'library_item')
->get(), ->get(),
]); ]);

View File

@@ -12,7 +12,9 @@ use RalphJSmit\Laravel\SEO\Support\SEOData;
class LibraryTable extends Component class LibraryTable extends Component
{ {
public Country $country; public Country $country;
public array $filters = []; public array $filters = [];
public bool $isLecturerPage = false; public bool $isLecturerPage = false;
public string $search = ''; public string $search = '';
@@ -23,8 +25,8 @@ class LibraryTable extends Component
protected $queryString = [ protected $queryString = [
'currentTab' => ['except' => '*'], 'currentTab' => ['except' => '*'],
'filters' => ['except' => ''], 'filters' => ['except' => ''],
'search' => ['except' => ''], 'search' => ['except' => ''],
]; ];
public function loadMore() public function loadMore()
@@ -52,7 +54,7 @@ class LibraryTable extends Component
public function render() public function render()
{ {
$shouldBePublic = !$this->isLecturerPage; $shouldBePublic = ! $this->isLecturerPage;
$libraries = \App\Models\Library::query() $libraries = \App\Models\Library::query()
->whereNull('parent_id') ->whereNull('parent_id')
->where('is_public', $shouldBePublic) ->where('is_public', $shouldBePublic)
@@ -61,7 +63,7 @@ class LibraryTable extends Component
$tabs = collect([ $tabs = collect([
[ [
'name' => '*', 'name' => '*',
] ],
]); ]);
foreach ($libraries as $library) { foreach ($libraries as $library) {
$tabs->push([ $tabs->push([
@@ -82,32 +84,32 @@ class LibraryTable extends Component
} }
return view('livewire.library.library-table', [ return view('livewire.library.library-table', [
'libraries' => $tabs, 'libraries' => $tabs,
'libraryItems' => LibraryItem::query() 'libraryItems' => LibraryItem::query()
->with([ ->with([
'lecturer', 'lecturer',
'tags', 'tags',
]) ])
->when($this->search, fn($query) => $query ->when($this->search, fn ($query) => $query
->where('name', 'ilike', '%'.$this->search.'%') ->where('name', 'ilike', '%'.$this->search.'%')
->orWhere(fn($query) => $query ->orWhere(fn ($query) => $query
->when(count($searchTags) > 0 && count($this->filters) < 1, ->when(count($searchTags) > 0 && count($this->filters) < 1,
fn($query) => $query->whereHas('tags', fn ($query) => $query->whereHas('tags',
fn($query) => $query->whereIn('tags.id', $searchTags))) fn ($query) => $query->whereIn('tags.id', $searchTags)))
) )
) )
->when($this->currentTab !== '*', fn($query) => $query ->when($this->currentTab !== '*', fn ($query) => $query
->whereHas('libraries', ->whereHas('libraries',
fn($query) => $query fn ($query) => $query
->where('libraries.name', $this->currentTab) ->where('libraries.name', $this->currentTab)
) )
) )
->when(isset($this->filters['tag']), fn($query) => $query->whereHas('tags', ->when(isset($this->filters['tag']), fn ($query) => $query->whereHas('tags',
fn($query) => $query->whereIn('tags.id', $this->filters['tag']))) fn ($query) => $query->whereIn('tags.id', $this->filters['tag'])))
->when(isset($this->filters['language']), ->when(isset($this->filters['language']),
fn($query) => $query->whereIn('language_code', $this->filters['language'])) fn ($query) => $query->whereIn('language_code', $this->filters['language']))
->whereHas('libraries', ->whereHas('libraries',
fn($query) => $query->where('libraries.is_public', $shouldBePublic)) fn ($query) => $query->where('libraries.is_public', $shouldBePublic))
->orderByDesc('library_items.created_at') ->orderByDesc('library_items.created_at')
->paginate($this->perPage), ->paginate($this->perPage),
])->layout('layouts.app', [ ])->layout('layouts.app', [
@@ -115,7 +117,7 @@ class LibraryTable extends Component
title: __('Library'), title: __('Library'),
description: __('Here you can find all content that are available in the library.'), description: __('Here you can find all content that are available in the library.'),
image: asset('img/screenshot.png') image: asset('img/screenshot.png')
) ),
]); ]);
} }
} }

View File

@@ -9,6 +9,7 @@ use Livewire\Component;
class SearchByTagComponent extends Component class SearchByTagComponent extends Component
{ {
public string $country = 'de'; public string $country = 'de';
public array $filters = []; public array $filters = [];
protected $queryString = [ protected $queryString = [
@@ -26,12 +27,12 @@ class SearchByTagComponent extends Component
->pluck('language_code') ->pluck('language_code')
->unique() ->unique()
->sort() ->sort()
->map(fn($item) => str($item) ->map(fn ($item) => str($item)
->before('_') ->before('_')
->toString()) ->toString())
->values() ->values()
->toArray(), ->toArray(),
'tags' => Tag::query() 'tags' => Tag::query()
->with([ ->with([
'libraryItems.libraries', 'libraryItems.libraries',
'libraryItems.lecturer', 'libraryItems.lecturer',
@@ -41,7 +42,7 @@ class SearchByTagComponent extends Component
]) ])
->where('type', 'library_item') ->where('type', 'library_item')
->whereHas('libraryItems.libraries', ->whereHas('libraryItems.libraries',
fn($query) => $query->where('is_public', $shouldBePublic)) fn ($query) => $query->where('is_public', $shouldBePublic))
->orderByDesc('library_items_count') ->orderByDesc('library_items_count')
->orderBy('tags.id') ->orderBy('tags.id')
->get(), ->get(),

View File

@@ -12,31 +12,34 @@ class MeetupEventForm extends Component
use Actions; use Actions;
public string $country; public string $country;
public ?MeetupEvent $meetupEvent = null; public ?MeetupEvent $meetupEvent = null;
public bool $recurring = false; public bool $recurring = false;
public int $repetitions = 52; public int $repetitions = 52;
public array $series = []; public array $series = [];
public function rules() public function rules()
{ {
return [ return [
'meetupEvent.meetup_id' => 'required', 'meetupEvent.meetup_id' => 'required',
'meetupEvent.start' => 'required', 'meetupEvent.start' => 'required',
'meetupEvent.location' => 'string|nullable', 'meetupEvent.location' => 'string|nullable',
'meetupEvent.description' => 'string|nullable', 'meetupEvent.description' => 'string|nullable',
'meetupEvent.link' => 'string|url|nullable', 'meetupEvent.link' => 'string|url|nullable',
'series.*.start' => 'required', 'series.*.start' => 'required',
'recurring' => 'bool', 'recurring' => 'bool',
'repetitions' => 'numeric|min:1', 'repetitions' => 'numeric|min:1',
]; ];
} }
public function mount() public function mount()
{ {
if (!$this->meetupEvent) { if (! $this->meetupEvent) {
$this->meetupEvent = new MeetupEvent( $this->meetupEvent = new MeetupEvent(
[ [
'start' => now() 'start' => now()
@@ -44,7 +47,7 @@ class MeetupEventForm extends Component
->addHours(17), ->addHours(17),
] ]
); );
} elseif (!auth() } elseif (! auth()
->user() ->user()
->can('update', $this->meetupEvent)) { ->can('update', $this->meetupEvent)) {
abort(403); abort(403);
@@ -86,15 +89,15 @@ class MeetupEventForm extends Component
$this->dialog() $this->dialog()
->confirm( ->confirm(
[ [
'title' => __('Delete event'), 'title' => __('Delete event'),
'description' => __('Are you sure you want to delete this event? This action cannot be undone.'), 'description' => __('Are you sure you want to delete this event? This action cannot be undone.'),
'icon' => 'warning', 'icon' => 'warning',
'accept' => [ 'accept' => [
'label' => __('Yes, delete'), 'label' => __('Yes, delete'),
'method' => 'deleteEvent', 'method' => 'deleteEvent',
], ],
'reject' => [ 'reject' => [
'label' => __('No, cancel'), 'label' => __('No, cancel'),
'method' => 'cancel', 'method' => 'cancel',
], ],
] ]
@@ -111,7 +114,7 @@ class MeetupEventForm extends Component
public function submit() public function submit()
{ {
$this->validate(); $this->validate();
if (!$this->meetupEvent->id) { if (! $this->meetupEvent->id) {
$hasAppointmentsOnThisDate = MeetupEvent::query() $hasAppointmentsOnThisDate = MeetupEvent::query()
->where('meetup_id', $this->meetupEvent->meetup_id) ->where('meetup_id', $this->meetupEvent->meetup_id)
->where('start', '>', Carbon::parse($this->meetupEvent->start) ->where('start', '>', Carbon::parse($this->meetupEvent->start)
@@ -129,7 +132,7 @@ class MeetupEventForm extends Component
$this->meetupEvent->save(); $this->meetupEvent->save();
if (!$this->meetupEvent->id && $this->recurring) { if (! $this->meetupEvent->id && $this->recurring) {
foreach ($this->series as $event) { foreach ($this->series as $event) {
$hasAppointmentsOnThisDate = MeetupEvent::query() $hasAppointmentsOnThisDate = MeetupEvent::query()
->where('meetup_id', $this->meetupEvent->meetup_id) ->where('meetup_id', $this->meetupEvent->meetup_id)

View File

@@ -11,7 +11,9 @@ use RalphJSmit\Laravel\SEO\Support\SEOData;
class LandingPage extends Component class LandingPage extends Component
{ {
public Meetup $meetup; public Meetup $meetup;
public Country $country; public Country $country;
public ?int $activeEvent = null; public ?int $activeEvent = null;
public ?int $year = null; public ?int $year = null;
@@ -34,7 +36,7 @@ class LandingPage extends Component
->where('meetup_events.start', '>=', now()) ->where('meetup_events.start', '>=', now())
->orderBy('start') ->orderBy('start')
->get(), ->get(),
'events' => MeetupEvent::query() 'events' => MeetupEvent::query()
->with([ ->with([
'meetup.city.country', 'meetup.city.country',
]) ])
@@ -42,11 +44,11 @@ class LandingPage extends Component
->where('meetup_events.start', '>=', now()) ->where('meetup_events.start', '>=', now())
->orderBy('start') ->orderBy('start')
->get() ->get()
->map(fn($event) => [ ->map(fn ($event) => [
'id' => $event->id, 'id' => $event->id,
'startDate' => $event->start, 'startDate' => $event->start,
'endDate' => $event->start->addHours(1), 'endDate' => $event->start->addHours(1),
'location' => $event->location, 'location' => $event->location,
'description' => $event->description, 'description' => $event->description,
]), ]),
]) ])
@@ -55,7 +57,7 @@ class LandingPage extends Component
title: $this->meetup->name, 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!'), 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'), image: $this->meetup->getFirstMediaUrl('logo'),
) ),
]); ]);
} }

View File

@@ -12,10 +12,15 @@ use RalphJSmit\Laravel\SEO\Support\SEOData;
class LandingPageEvent extends Component class LandingPageEvent extends Component
{ {
public MeetupEvent $meetupEvent; public MeetupEvent $meetupEvent;
public Country $country; public Country $country;
public ?Meetup $meetup = null; public ?Meetup $meetup = null;
public bool $willShowUp = false; public bool $willShowUp = false;
public bool $perhapsShowUp = false; public bool $perhapsShowUp = false;
public string $name = ''; public string $name = '';
public function rules() public function rules()
@@ -23,7 +28,7 @@ class LandingPageEvent extends Component
return [ return [
'name' => [ 'name' => [
'required', 'required',
new UniqueAttendeeName($this->meetupEvent) new UniqueAttendeeName($this->meetupEvent),
], ],
]; ];
} }
@@ -40,33 +45,33 @@ class LandingPageEvent extends Component
$attendees = collect($this->meetupEvent->attendees); $attendees = collect($this->meetupEvent->attendees);
$mightAttendees = collect($this->meetupEvent->might_attendees); $mightAttendees = collect($this->meetupEvent->might_attendees);
if (auth()->check() && $attendees->contains(fn($value) => str($value)->contains('id_'.auth()->id()))) { 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())) $this->name = str($attendees->filter(fn ($value) => str($value)->contains('id_'.auth()->id()))
->first()) ->first())
->after('|') ->after('|')
->toString(); ->toString();
$this->willShowUp = true; $this->willShowUp = true;
} }
if (!auth()->check() && $attendees->contains(fn($value) => str($value)->contains('anon_'.session()->getId()))) { 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())) $this->name = str($attendees->filter(fn ($value) => str($value)->contains('anon_'.session()->getId()))
->first()) ->first())
->after('|') ->after('|')
->toString(); ->toString();
$this->willShowUp = true; $this->willShowUp = true;
} }
if (auth()->check() && $mightAttendees->contains(fn($value) => str($value)->contains('id_'.auth()->id()))) { 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())) $this->name = str($mightAttendees->filter(fn ($value) => str($value)->contains('id_'.auth()->id()))
->first()) ->first())
->after('|') ->after('|')
->toString(); ->toString();
$this->perhapsShowUp = true; $this->perhapsShowUp = true;
} }
if (!auth()->check() && $mightAttendees->contains(fn($value if (! auth()->check() && $mightAttendees->contains(fn ($value
) => str($value)->contains('anon_'.session()->getId()))) { ) => str($value)->contains('anon_'.session()->getId()))) {
$this->name = str($mightAttendees->filter(fn($value) => str($value)->contains('anon_'.session()->getId())) $this->name = str($mightAttendees->filter(fn ($value) => str($value)->contains('anon_'.session()->getId()))
->first()) ->first())
->after('|') ->after('|')
->toString(); ->toString();
@@ -79,29 +84,29 @@ class LandingPageEvent extends Component
$attendees = collect($this->meetupEvent->attendees); $attendees = collect($this->meetupEvent->attendees);
$mightAttendees = collect($this->meetupEvent->might_attendees); $mightAttendees = collect($this->meetupEvent->might_attendees);
if (auth()->check() && $attendees->contains(fn($value) => str($value)->contains('id_'.auth()->id()))) { if (auth()->check() && $attendees->contains(fn ($value) => str($value)->contains('id_'.auth()->id()))) {
$attendees = $attendees->filter(fn($value) => !str($value)->contains('id_'.auth()->id())); $attendees = $attendees->filter(fn ($value) => ! str($value)->contains('id_'.auth()->id()));
$this->willShowUp = false; $this->willShowUp = false;
} }
if (!auth()->check() && $attendees->contains(fn($value) => str($value)->contains('anon_'.session()->getId()))) { if (! auth()->check() && $attendees->contains(fn ($value) => str($value)->contains('anon_'.session()->getId()))) {
$attendees = $attendees->filter(fn($value) => !str($value)->contains('anon_'.session()->getId())); $attendees = $attendees->filter(fn ($value) => ! str($value)->contains('anon_'.session()->getId()));
$this->willShowUp = false; $this->willShowUp = false;
} }
if (auth()->check() && $mightAttendees->contains(fn($value) => str($value)->contains('id_'.auth()->id()))) { if (auth()->check() && $mightAttendees->contains(fn ($value) => str($value)->contains('id_'.auth()->id()))) {
$mightAttendees = $mightAttendees->filter(fn($value) => !str($value)->contains('id_'.auth()->id())); $mightAttendees = $mightAttendees->filter(fn ($value) => ! str($value)->contains('id_'.auth()->id()));
$this->perhapsShowUp = false; $this->perhapsShowUp = false;
} }
if (!auth()->check() && $mightAttendees->contains(fn($value if (! auth()->check() && $mightAttendees->contains(fn ($value
) => str($value)->contains('anon_'.session()->getId()))) { ) => str($value)->contains('anon_'.session()->getId()))) {
$mightAttendees = $mightAttendees->filter(fn($value) => !str($value)->contains('anon_'.session()->getId())); $mightAttendees = $mightAttendees->filter(fn ($value) => ! str($value)->contains('anon_'.session()->getId()));
$this->perhapsShowUp = false; $this->perhapsShowUp = false;
} }
$this->meetupEvent->update([ $this->meetupEvent->update([
'attendees' => $attendees->toArray(), 'attendees' => $attendees->toArray(),
'might_attendees' => $mightAttendees->toArray(), 'might_attendees' => $mightAttendees->toArray(),
]); ]);
} }
@@ -111,12 +116,12 @@ class LandingPageEvent extends Component
$this->validate(); $this->validate();
$attendees = collect($this->meetupEvent->attendees); $attendees = collect($this->meetupEvent->attendees);
if (auth()->check() && !$attendees->contains('id_'.auth()->id().'|'.$this->name)) { if (auth()->check() && ! $attendees->contains('id_'.auth()->id().'|'.$this->name)) {
$attendees->push('id_'.auth()->id().'|'.$this->name); $attendees->push('id_'.auth()->id().'|'.$this->name);
$this->willShowUp = true; $this->willShowUp = true;
} }
if (!auth()->check() && !$attendees->contains('anon_'.session()->getId().'|'.$this->name)) { if (! auth()->check() && ! $attendees->contains('anon_'.session()->getId().'|'.$this->name)) {
$attendees->push('anon_'.session()->getId().'|'.$this->name); $attendees->push('anon_'.session()->getId().'|'.$this->name);
$this->willShowUp = true; $this->willShowUp = true;
} }
@@ -131,12 +136,12 @@ class LandingPageEvent extends Component
$this->validate(); $this->validate();
$mightAttendees = collect($this->meetupEvent->might_attendees); $mightAttendees = collect($this->meetupEvent->might_attendees);
if (auth()->check() && !$mightAttendees->contains('id_'.auth()->id().'|'.$this->name)) { if (auth()->check() && ! $mightAttendees->contains('id_'.auth()->id().'|'.$this->name)) {
$mightAttendees->push('id_'.auth()->id().'|'.$this->name); $mightAttendees->push('id_'.auth()->id().'|'.$this->name);
$this->perhapsShowUp = true; $this->perhapsShowUp = true;
} }
if (!auth()->check() && !$mightAttendees->contains('anon_'.session()->getId().'|'.$this->name)) { if (! auth()->check() && ! $mightAttendees->contains('anon_'.session()->getId().'|'.$this->name)) {
$mightAttendees->push('anon_'.session()->getId().'|'.$this->name); $mightAttendees->push('anon_'.session()->getId().'|'.$this->name);
$this->perhapsShowUp = true; $this->perhapsShowUp = true;
} }
@@ -153,7 +158,7 @@ class LandingPageEvent extends Component
title: $this->meetupEvent->start->asDateTime().' - '.$this->meetup->name, 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, description: __('Here you can confirm your participation and find more information about the Meetup.').' - '.$this->meetupEvent->description,
image: $this->meetup->getFirstMediaUrl('logo'), image: $this->meetup->getFirstMediaUrl('logo'),
) ),
]); ]);
} }
} }

View File

@@ -20,7 +20,7 @@ class MeetupEventTable extends Component
public function mount() public function mount()
{ {
if (!$this->year) { if (! $this->year) {
$this->year = now()->year; $this->year = now()->year;
} }
} }
@@ -34,26 +34,26 @@ class MeetupEventTable extends Component
]) ])
->where('meetup_events.start', '>=', now()) ->where('meetup_events.start', '>=', now())
->whereHas('meetup.city.country', ->whereHas('meetup.city.country',
fn($query) => $query->where('countries.code', $this->country->code)) fn ($query) => $query->where('countries.code', $this->country->code))
->get() ->get()
->map(fn($event) => [ ->map(fn ($event) => [
'id' => $event->id, 'id' => $event->id,
'name' => $event->meetup->name.': '.$event->location, 'name' => $event->meetup->name.': '.$event->location,
'coords' => [$event->meetup->city->latitude, $event->meetup->city->longitude], 'coords' => [$event->meetup->city->latitude, $event->meetup->city->longitude],
]), ]),
'events' => MeetupEvent::query() 'events' => MeetupEvent::query()
->with([ ->with([
'meetup.city.country', 'meetup.city.country',
]) ])
->where('meetup_events.start', '>=', now()) ->where('meetup_events.start', '>=', now())
->whereHas('meetup.city.country', ->whereHas('meetup.city.country',
fn($query) => $query->where('countries.code', $this->country->code)) fn ($query) => $query->where('countries.code', $this->country->code))
->get() ->get()
->map(fn($event) => [ ->map(fn ($event) => [
'id' => $event->id, 'id' => $event->id,
'startDate' => $event->start, 'startDate' => $event->start,
'endDate' => $event->start->addHours(1), 'endDate' => $event->start->addHours(1),
'location' => $event->location, 'location' => $event->location,
'description' => $event->description, 'description' => $event->description,
]), ]),
])->layout('layouts.app', [ ])->layout('layouts.app', [
@@ -61,7 +61,7 @@ class MeetupEventTable extends Component
title: __('Meetup dates'), title: __('Meetup dates'),
description: __('List of all meetup dates'), description: __('List of all meetup dates'),
image: asset('img/screenshot.png') image: asset('img/screenshot.png')
) ),
]); ]);
} }
@@ -69,28 +69,27 @@ class MeetupEventTable extends Component
{ {
return to_route('meetup.table.meetupEvent', [ return to_route('meetup.table.meetupEvent', [
'#table', '#table',
'country' => $this->country->code, 'country' => $this->country->code,
'year' => $this->year, 'year' => $this->year,
'meetup_events' => [ 'meetup_events' => [
'filters' => [ 'filters' => [
'byid' => $id, 'byid' => $id,
], ],
] ],
]); ]);
} }
public function popover($content, $ids) public function popover($content, $ids)
{ {
return to_route('meetup.table.meetupEvent', [ return to_route('meetup.table.meetupEvent', [
'#table', '#table',
'year' => $this->year, 'year' => $this->year,
'country' => $this->country->code, 'country' => $this->country->code,
'meetup_events' => [ 'meetup_events' => [
'filters' => [ 'filters' => [
'byid' => $ids, 'byid' => $ids,
] ],
] ],
]); ]);
} }
} }

View File

@@ -18,7 +18,7 @@ class MeetupTable extends Component
return to_route('meetup.landing', [ return to_route('meetup.landing', [
'country' => $meetup->city->country->code, 'country' => $meetup->city->country->code,
'meetup' => $meetup, 'meetup' => $meetup,
]); ]);
} }
@@ -32,11 +32,11 @@ class MeetupTable extends Component
'city.country', 'city.country',
]) ])
->whereHas('city.country', ->whereHas('city.country',
fn($query) => $query->where('countries.code', $this->country->code)) fn ($query) => $query->where('countries.code', $this->country->code))
->get() ->get()
->map(fn($meetup) => [ ->map(fn ($meetup) => [
'id' => $meetup->id, 'id' => $meetup->id,
'name' => $meetup->name, 'name' => $meetup->name,
'coords' => [$meetup->city->latitude, $meetup->city->longitude], 'coords' => [$meetup->city->latitude, $meetup->city->longitude],
]), ]),
])->layout('layouts.app', [ ])->layout('layouts.app', [
@@ -44,7 +44,7 @@ class MeetupTable extends Component
title: __('Meetups'), 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!'), 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') image: asset('img/screenshot.png')
) ),
]); ]);
} }
} }

View File

@@ -20,6 +20,7 @@ class PrepareForBtcMapItem extends Component
public string $search = ''; public string $search = '';
public $population; public $population;
public $population_date = ''; public $population_date = '';
public ?int $osm_id = null; public ?int $osm_id = null;
@@ -52,7 +53,7 @@ class PrepareForBtcMapItem extends Component
public function rules(): array public function rules(): array
{ {
return [ return [
'search' => 'required|string', 'search' => 'required|string',
'currentPercentage' => 'required|numeric', 'currentPercentage' => 'required|numeric',
'model.simplified_geojson' => 'nullable', 'model.simplified_geojson' => 'nullable',
@@ -60,7 +61,7 @@ class PrepareForBtcMapItem extends Component
'OSMBoundaries' => 'bool', 'OSMBoundaries' => 'bool',
'polygonsOSMfr' => 'bool', 'polygonsOSMfr' => 'bool',
'population' => 'nullable|numeric', 'population' => 'nullable|numeric',
'population_date' => 'nullable|string', 'population_date' => 'nullable|string',
'polygonsOSMfrX' => 'numeric|max:1', 'polygonsOSMfrX' => 'numeric|max:1',
@@ -84,7 +85,7 @@ class PrepareForBtcMapItem extends Component
private function getSearchResults(): void private function getSearchResults(): void
{ {
$responses = Http::pool(fn(Pool $pool) => [ $responses = Http::pool(fn (Pool $pool) => [
$pool->acceptJson() $pool->acceptJson()
->get( ->get(
sprintf('https://nominatim.openstreetmap.org/search?q=%s&format=json&polygon_geojson=1&polygon_threshold=0.0003&email='.config('services.nominatim.email'), sprintf('https://nominatim.openstreetmap.org/search?q=%s&format=json&polygon_geojson=1&polygon_threshold=0.0003&email='.config('services.nominatim.email'),
@@ -93,7 +94,7 @@ class PrepareForBtcMapItem extends Component
]); ]);
$this->osmSearchResults = collect($responses[0]->json()) $this->osmSearchResults = collect($responses[0]->json())
->filter(fn($item ->filter(fn ($item
) => ( ) => (
$item['geojson']['type'] === 'Polygon' $item['geojson']['type'] === 'Polygon'
|| $item['geojson']['type'] === 'MultiPolygon' || $item['geojson']['type'] === 'MultiPolygon'
@@ -156,7 +157,6 @@ class PrepareForBtcMapItem extends Component
// emit event for AlpineJS // emit event for AlpineJS
$this->emit('geoJsonUpdated'); $this->emit('geoJsonUpdated');
} catch (\Exception $e) { } catch (\Exception $e) {
$this->notification() $this->notification()
->error('Error', $e->getMessage()); ->error('Error', $e->getMessage());
@@ -180,9 +180,9 @@ class PrepareForBtcMapItem extends Component
->post( ->post(
'https://polygons.openstreetmap.fr/?id='.$this->selectedItemOSMPolygons['osm_id'], 'https://polygons.openstreetmap.fr/?id='.$this->selectedItemOSMPolygons['osm_id'],
[ [
'x' => $this->polygonsOSMfrX, 'x' => $this->polygonsOSMfrX,
'y' => $this->polygonsOSMfrY, 'y' => $this->polygonsOSMfrY,
'z' => $this->polygonsOSMfrZ, 'z' => $this->polygonsOSMfrZ,
'generate' => 'Submit+Query', 'generate' => 'Submit+Query',
] ]
); );
@@ -247,9 +247,9 @@ class PrepareForBtcMapItem extends Component
$response = Http::acceptJson() $response = Http::acceptJson()
->asForm() ->asForm()
->post('https://osm-boundaries.com/Ajax/GetBoundary', [ ->post('https://osm-boundaries.com/Ajax/GetBoundary', [
'db' => 'osm20221205', 'db' => 'osm20221205',
'waterOrLand' => 'water', 'waterOrLand' => 'water',
'osmId' => '-'.$this->selectedItemOSMPolygons['osm_id'], 'osmId' => '-'.$this->selectedItemOSMPolygons['osm_id'],
]); ]);
if ($response->json()) { if ($response->json()) {
if (count($response->json()['coordinates'], COUNT_RECURSIVE) > 100000) { if (count($response->json()['coordinates'], COUNT_RECURSIVE) > 100000) {
@@ -286,7 +286,7 @@ class PrepareForBtcMapItem extends Component
$this->model->population = str($value) $this->model->population = str($value)
->replace(['.', ','], '') ->replace(['.', ','], '')
->toInteger(); ->toInteger();
if (!$this->model->population_date) { if (! $this->model->population_date) {
$this->model->population_date = '2021-12-31'; $this->model->population_date = '2021-12-31';
} }
$this->model->save(); $this->model->save();

View File

@@ -4,7 +4,6 @@ namespace App\Http\Livewire\Meetup;
use App\Models\Country; use App\Models\Country;
use App\Models\Meetup; use App\Models\Meetup;
use App\Models\MeetupEvent;
use Livewire\Component; use Livewire\Component;
use RalphJSmit\Laravel\SEO\Support\SEOData; use RalphJSmit\Laravel\SEO\Support\SEOData;
@@ -19,7 +18,7 @@ class WorldMap extends Component
return to_route('meetup.landing', [ return to_route('meetup.landing', [
'country' => $meetup->city->country->code, 'country' => $meetup->city->country->code,
'meetup' => $meetup, 'meetup' => $meetup,
]); ]);
} }
@@ -31,16 +30,16 @@ class WorldMap extends Component
'city.country', 'city.country',
]) ])
->get() ->get()
->map(fn($meetup) => [ ->map(fn ($meetup) => [
'id' => $meetup->id, 'id' => $meetup->id,
'name' => $meetup->name, 'name' => $meetup->name,
'coords' => [$meetup->city->latitude, $meetup->city->longitude], 'coords' => [$meetup->city->latitude, $meetup->city->longitude],
]), ]),
])->layout('layouts.app', [ ])->layout('layouts.app', [
'SEOData' => new SEOData( 'SEOData' => new SEOData(
title: __('World map of meetups'), title: __('World map of meetups'),
image: asset('img/screenshot.png') image: asset('img/screenshot.png')
) ),
]); ]);
} }
} }

View File

@@ -31,7 +31,7 @@ class ArticleOverview extends Component
if ($libraryItem->lecturer->twitter_username && $libraryItem->type !== 'markdown_article') { if ($libraryItem->lecturer->twitter_username && $libraryItem->type !== 'markdown_article') {
$libraryItemName .= ' von @'.$libraryItem->lecturer->twitter_username; $libraryItemName .= ' von @'.$libraryItem->lecturer->twitter_username;
} }
if (!$libraryItem->lecturer->twitter_username) { if (! $libraryItem->lecturer->twitter_username) {
$libraryItemName .= ' von '.$libraryItem->lecturer->name; $libraryItemName .= ' von '.$libraryItem->lecturer->name;
} }
@@ -39,7 +39,7 @@ class ArticleOverview extends Component
if (config('feeds.services.twitterAccountId')) { if (config('feeds.services.twitterAccountId')) {
$this->setNewAccessToken(1); $this->setNewAccessToken(1);
if (!$libraryItem->approved) { if (! $libraryItem->approved) {
$this->notification() $this->notification()
->error(__('Article not approved yet')); ->error(__('Article not approved yet'));
@@ -98,7 +98,7 @@ class ArticleOverview extends Component
title: __('News'), title: __('News'),
description: __('Here we post important news that is relevant for everyone.'), description: __('Here we post important news that is relevant for everyone.'),
image: asset('img/einundzwanzig-news-colored.png'), image: asset('img/einundzwanzig-news-colored.png'),
) ),
]); ]);
} }
} }

View File

@@ -12,28 +12,33 @@ class NewsArticleForm extends Component
use WithFileUploads; use WithFileUploads;
public ?LibraryItem $libraryItem = null; public ?LibraryItem $libraryItem = null;
public $image; public $image;
public $currentImage = 0; public $currentImage = 0;
public $images; public $images;
public $imagesCloned = []; public $imagesCloned = [];
public array $temporaryUrls = []; public array $temporaryUrls = [];
public function rules() public function rules()
{ {
return [ return [
'image' => [Rule::requiredIf(!$this->libraryItem->id), 'nullable', 'mimes:jpeg,png,jpg,gif', 'max:10240'], 'image' => [Rule::requiredIf(! $this->libraryItem->id), 'nullable', 'mimes:jpeg,png,jpg,gif', 'max:10240'],
'libraryItem.lecturer_id' => 'required', 'libraryItem.lecturer_id' => 'required',
'libraryItem.name' => 'required', 'libraryItem.name' => 'required',
'libraryItem.type' => 'required', 'libraryItem.type' => 'required',
'libraryItem.language_code' => 'required', 'libraryItem.language_code' => 'required',
'libraryItem.value' => 'required', 'libraryItem.value' => 'required',
'libraryItem.subtitle' => 'required', 'libraryItem.subtitle' => 'required',
'libraryItem.excerpt' => 'required', 'libraryItem.excerpt' => 'required',
'libraryItem.main_image_caption' => 'required', 'libraryItem.main_image_caption' => 'required',
'libraryItem.read_time' => 'required', 'libraryItem.read_time' => 'required',
'libraryItem.approved' => 'boolean', 'libraryItem.approved' => 'boolean',
'libraryItem.news' => 'boolean', 'libraryItem.news' => 'boolean',
]; ];
} }
@@ -41,12 +46,12 @@ class NewsArticleForm extends Component
{ {
if ($this->libraryItem === null) { if ($this->libraryItem === null) {
$this->libraryItem = new LibraryItem([ $this->libraryItem = new LibraryItem([
'type' => 'markdown_article', 'type' => 'markdown_article',
'value' => '', 'value' => '',
'read_time' => 1, 'read_time' => 1,
'news' => true, 'news' => true,
'language_code' => 'de', 'language_code' => 'de',
'approved' => auth() 'approved' => auth()
->user() ->user()
->hasRole('news-editor'), ->hasRole('news-editor'),
]); ]);

View File

@@ -17,7 +17,7 @@ class InternArticleView extends Component
'libraries', 'libraries',
]); ]);
if ($this->libraryItem->libraries->where('is_public', false) if ($this->libraryItem->libraries->where('is_public', false)
->count() > 0 && !auth()->check()) { ->count() > 0 && ! auth()->check()) {
abort(403, __('Sorry! You are not authorized to perform this action.')); abort(403, __('Sorry! You are not authorized to perform this action.'));
} }
} }
@@ -38,7 +38,7 @@ class InternArticleView extends Component
image: $this->libraryItem->getFirstMedia('main') ? $this->libraryItem->getFirstMediaUrl('main') : asset('img/einundzwanzig-wallpaper-benrath.png'), image: $this->libraryItem->getFirstMedia('main') ? $this->libraryItem->getFirstMediaUrl('main') : asset('img/einundzwanzig-wallpaper-benrath.png'),
published_time: Carbon::parse($this->libraryItem->created_at), published_time: Carbon::parse($this->libraryItem->created_at),
type: 'article', type: 'article',
) ),
]); ]);
} }
} }

View File

@@ -11,9 +11,13 @@ class Meetups extends Component
use Actions; use Actions;
public $search = ''; public $search = '';
public $meetups; public $meetups;
public $myMeetups = []; public $myMeetups = [];
public $myMeetupNames = []; public $myMeetupNames = [];
public $hasMeetups = false; public $hasMeetups = false;
public function rules() public function rules()
@@ -25,7 +29,7 @@ class Meetups extends Component
public function mount() public function mount()
{ {
if (!auth()->user()) { if (! auth()->user()) {
return to_route('auth.ln'); return to_route('auth.ln');
} }

View File

@@ -17,7 +17,7 @@ class CityTable extends Component
title: __('Courses'), title: __('Courses'),
description: __('Choose your city, search for courses in the surrounding area and select a topic that suits you.'), description: __('Choose your city, search for courses in the surrounding area and select a topic that suits you.'),
image: asset('img/screenshot.png') image: asset('img/screenshot.png')
) ),
]); ]);
} }
} }

View File

@@ -17,7 +17,7 @@ class CourseTable extends Component
title: __('Courses'), title: __('Courses'),
description: __('Choose your city, search for courses in the surrounding area and select a topic that suits you.'), description: __('Choose your city, search for courses in the surrounding area and select a topic that suits you.'),
image: asset('img/screenshot.png') image: asset('img/screenshot.png')
) ),
]); ]);
} }
} }

View File

@@ -17,7 +17,7 @@ class EventTable extends Component
public function mount() public function mount()
{ {
if (!$this->year) { if (! $this->year) {
$this->year = now()->year; $this->year = now()->year;
} }
} }
@@ -31,28 +31,28 @@ class EventTable extends Component
'venue.city.country', 'venue.city.country',
]) ])
->where('from', '>=', now()) ->where('from', '>=', now())
->where(fn($query) => $query ->where(fn ($query) => $query
->whereHas('venue.city.country', ->whereHas('venue.city.country',
fn($query) => $query->where('countries.code', $this->country->code)) fn ($query) => $query->where('countries.code', $this->country->code))
) )
->get() ->get()
->map(fn($event) => [ ->map(fn ($event) => [
'id' => $event->id, 'id' => $event->id,
'name' => $event->course->name, 'name' => $event->course->name,
'coords' => [$event->venue->city->latitude, $event->venue->city->longitude], 'coords' => [$event->venue->city->latitude, $event->venue->city->longitude],
]), ]),
'events' => CourseEvent::query() 'events' => CourseEvent::query()
->with([ ->with([
'course', 'course',
'venue.city.country', 'venue.city.country',
]) ])
->where('from', '>=', now()) ->where('from', '>=', now())
->get() ->get()
->map(fn($event) => [ ->map(fn ($event) => [
'id' => $event->id, 'id' => $event->id,
'startDate' => $event->from, 'startDate' => $event->from,
'endDate' => $event->to, 'endDate' => $event->to,
'location' => $event->course->name, 'location' => $event->course->name,
'description' => $event->venue->name, 'description' => $event->venue->name,
]), ]),
])->layout('layouts.app', [ ])->layout('layouts.app', [
@@ -60,7 +60,7 @@ class EventTable extends Component
title: __('Dates'), title: __('Dates'),
description: __('Dates for courses about Bitcoin.'), description: __('Dates for courses about Bitcoin.'),
image: asset('img/screenshot.png') image: asset('img/screenshot.png')
) ),
]); ]);
} }
@@ -69,12 +69,12 @@ class EventTable extends Component
return to_route('school.table.event', [ return to_route('school.table.event', [
'#table', '#table',
'country' => $this->country->code, 'country' => $this->country->code,
'year' => $this->year, 'year' => $this->year,
'course_events' => [ 'course_events' => [
'filters' => [ 'filters' => [
'byid' => $id, 'byid' => $id,
], ],
] ],
]); ]);
} }
@@ -83,12 +83,12 @@ class EventTable extends Component
return to_route('school.table.event', [ return to_route('school.table.event', [
'#table', '#table',
'country' => $this->country->code, 'country' => $this->country->code,
'year' => $this->year, 'year' => $this->year,
'course_events' => [ 'course_events' => [
'filters' => [ 'filters' => [
'byid' => $ids, 'byid' => $ids,
] ],
] ],
]); ]);
} }
} }

View File

@@ -11,9 +11,11 @@ use RalphJSmit\Laravel\SEO\Support\SEOData;
class LecturerLandingPage extends Component class LecturerLandingPage extends Component
{ {
public Lecturer $lecturer; public Lecturer $lecturer;
public Country $country; public Country $country;
public ?int $year = null; public ?int $year = null;
public ?int $activeEvent = null; public ?int $activeEvent = null;
public function render() public function render()
@@ -26,18 +28,18 @@ class LecturerLandingPage extends Component
}) })
->orderBy('from') ->orderBy('from')
->get(), ->get(),
'events' => CourseEvent::query() 'events' => CourseEvent::query()
->where('from', '>=', now()) ->where('from', '>=', now())
->whereHas('course', function ($query) { ->whereHas('course', function ($query) {
$query->where('lecturer_id', $this->lecturer->id); $query->where('lecturer_id', $this->lecturer->id);
}) })
->orderBy('from') ->orderBy('from')
->get() ->get()
->map(fn($event) => [ ->map(fn ($event) => [
'id' => $event->id, 'id' => $event->id,
'startDate' => $event->from, 'startDate' => $event->from,
'endDate' => $event->to, 'endDate' => $event->to,
'location' => $event->course->name, 'location' => $event->course->name,
'description' => $event->venue->name, 'description' => $event->venue->name,
]), ]),
]) ])
@@ -46,7 +48,7 @@ class LecturerLandingPage extends Component
title: $this->lecturer->name, title: $this->lecturer->name,
description: $this->lecturer->intro ?? __('This lecturer has not yet written an introduction.'), description: $this->lecturer->intro ?? __('This lecturer has not yet written an introduction.'),
image: $this->lecturer->getFirstMediaUrl('avatar'), image: $this->lecturer->getFirstMediaUrl('avatar'),
) ),
]); ]);
} }

View File

@@ -17,7 +17,7 @@ class LecturerTable extends Component
title: __('Lecturers'), title: __('Lecturers'),
description: __('Lecturers in the surrounding area.'), description: __('Lecturers in the surrounding area.'),
image: asset('img/screenshot.png') image: asset('img/screenshot.png')
) ),
]); ]);
} }
} }

View File

@@ -8,6 +8,7 @@ use Livewire\Component;
class SearchByTagComponent extends Component class SearchByTagComponent extends Component
{ {
public string $country = 'de'; public string $country = 'de';
public ?array $courses = []; public ?array $courses = [];
protected $queryString = [ protected $queryString = [

View File

@@ -17,7 +17,7 @@ class VenueTable extends Component
title: __('Venues'), title: __('Venues'),
description: __('Venues in the surrounding area.'), description: __('Venues in the surrounding area.'),
image: asset('img/screenshot.png') image: asset('img/screenshot.png')
) ),
]); ]);
} }
} }

View File

@@ -10,8 +10,8 @@ use Rappasoft\LaravelLivewireTables\Views\Filters\TextFilter;
class BitcoinEventTable extends DataTableComponent class BitcoinEventTable extends DataTableComponent
{ {
public string $country; public string $country;
public string $tableName = 'bitcoin_events'; public string $tableName = 'bitcoin_events';
public function configure(): void public function configure(): void
@@ -20,17 +20,17 @@ class BitcoinEventTable extends DataTableComponent
->setDefaultSort('from', 'asc') ->setDefaultSort('from', 'asc')
->setAdditionalSelects([ ->setAdditionalSelects([
'bitcoin_events.id', 'bitcoin_events.id',
'bitcoin_events.venue_id' 'bitcoin_events.venue_id',
]) ])
->setThAttributes(function (Column $column) { ->setThAttributes(function (Column $column) {
return [ 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', '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, 'default' => false,
]; ];
}) })
->setTdAttributes(function (Column $column, $row, $columnIndex, $rowIndex) { ->setTdAttributes(function (Column $column, $row, $columnIndex, $rowIndex) {
return [ return [
'class' => 'px-6 py-4 text-sm font-medium dark:text-white', 'class' => 'px-6 py-4 text-sm font-medium dark:text-white',
'default' => false, 'default' => false,
]; ];
}) })
@@ -54,29 +54,29 @@ class BitcoinEventTable extends DataTableComponent
return [ return [
Column::make(__('Country'), 'venue.city.country.name') Column::make(__('Country'), 'venue.city.country.name')
->format( ->format(
fn($value, $row, Column $column) => view('columns.bitcoin_events.country')->withRow($row) fn ($value, $row, Column $column) => view('columns.bitcoin_events.country')->withRow($row)
) )
->sortable() ->sortable()
->collapseOnMobile(), ->collapseOnMobile(),
Column::make(__('Title'), 'title') Column::make(__('Title'), 'title')
->format( ->format(
fn($value, $row, Column $column) => view('columns.bitcoin_events.title')->withRow($row) fn ($value, $row, Column $column) => view('columns.bitcoin_events.title')->withRow($row)
) )
->sortable(), ->sortable(),
Column::make(__('From'), 'from') Column::make(__('From'), 'from')
->format( ->format(
fn($value, $row, Column $column) => $value->asDateTime() fn ($value, $row, Column $column) => $value->asDateTime()
), ),
Column::make(__('To'), 'to') Column::make(__('To'), 'to')
->format( ->format(
fn($value, $row, Column $column) => $value->asDateTime() fn ($value, $row, Column $column) => $value->asDateTime()
) )
->collapseOnMobile(), ->collapseOnMobile(),
Column::make(__('Venue'), 'venue.name') Column::make(__('Venue'), 'venue.name')
->collapseOnMobile(), ->collapseOnMobile(),
Column::make(__('Link'), 'link') Column::make(__('Link'), 'link')
->format( ->format(
fn($value, $row, Column $column) => view('columns.bitcoin_events.link')->withRow($row) fn ($value, $row, Column $column) => view('columns.bitcoin_events.link')->withRow($row)
) )
->sortable() ->sortable()
->collapseOnMobile(), ->collapseOnMobile(),
@@ -87,12 +87,12 @@ class BitcoinEventTable extends DataTableComponent
{ {
return BitcoinEvent::query() return BitcoinEvent::query()
->with([ ->with([
'venue.city.country' 'venue.city.country',
]) ])
->where('bitcoin_events.from', '>=', now()) ->where('bitcoin_events.from', '>=', now())
->where(fn($query) => $query ->where(fn ($query) => $query
->whereHas('venue.city.country', ->whereHas('venue.city.country',
fn($query) => $query->where('code', $this->country)) fn ($query) => $query->where('code', $this->country))
->orWhere('show_worldwide', true) ->orWhere('show_worldwide', true)
); );
} }

View File

@@ -3,9 +3,7 @@
namespace App\Http\Livewire\Tables; namespace App\Http\Livewire\Tables;
use App\Models\BookCase; use App\Models\BookCase;
use App\Models\OrangePill;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Livewire\WithFileUploads;
use Rappasoft\LaravelLivewireTables\DataTableComponent; use Rappasoft\LaravelLivewireTables\DataTableComponent;
use Rappasoft\LaravelLivewireTables\Views\Column; use Rappasoft\LaravelLivewireTables\Views\Column;
use Rappasoft\LaravelLivewireTables\Views\Filters\TextFilter; use Rappasoft\LaravelLivewireTables\Views\Filters\TextFilter;
@@ -16,6 +14,7 @@ class BookCaseTable extends DataTableComponent
use Actions; use Actions;
public string $country; public string $country;
public string $tableName = 'bookcases'; public string $tableName = 'bookcases';
public function configure(): void public function configure(): void
@@ -24,14 +23,13 @@ class BookCaseTable extends DataTableComponent
->setAdditionalSelects(['id', 'homepage']) ->setAdditionalSelects(['id', 'homepage'])
->setThAttributes(function (Column $column) { ->setThAttributes(function (Column $column) {
return [ 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', '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, 'default' => false,
]; ];
}) })
->setTdAttributes(function (Column $column, $row, $columnIndex, $rowIndex) { ->setTdAttributes(function (Column $column, $row, $columnIndex, $rowIndex) {
return [ return [
'class' => 'px-6 py-4 text-sm font-medium dark:text-white', 'class' => 'px-6 py-4 text-sm font-medium dark:text-white',
'default' => false, 'default' => false,
]; ];
}) })
@@ -39,7 +37,6 @@ class BookCaseTable extends DataTableComponent
->setPerPage(10); ->setPerPage(10);
} }
public function filters(): array public function filters(): array
{ {
return [ return [
@@ -54,27 +51,27 @@ class BookCaseTable extends DataTableComponent
public function columns(): array public function columns(): array
{ {
return [ return [
Column::make("Name", "title") Column::make('Name', 'title')
->sortable() ->sortable()
->searchable( ->searchable(
function (Builder $query, $searchTerm) { function (Builder $query, $searchTerm) {
$query->where('title', 'ilike', '%'.$searchTerm.'%'); $query->where('title', 'ilike', '%'.$searchTerm.'%');
} }
), ),
Column::make("Adresse", "address") Column::make('Adresse', 'address')
->sortable() ->sortable()
->searchable(), ->searchable(),
Column::make("Bitcoin-Bücher") Column::make('Bitcoin-Bücher')
->label( ->label(
fn( fn (
$row, $row,
Column $column Column $column
) => $row->orangePills->sum('amount') ) => $row->orangePills->sum('amount')
) )
->collapseOnMobile(), ->collapseOnMobile(),
Column::make("Letzter Input") Column::make('Letzter Input')
->label( ->label(
fn( fn (
$row, $row,
Column $column Column $column
) => $row->orangePills() ) => $row->orangePills()
@@ -82,9 +79,9 @@ class BookCaseTable extends DataTableComponent
->first()?->date->asDate() ->first()?->date->asDate()
) )
->collapseOnMobile(), ->collapseOnMobile(),
Column::make("Link") Column::make('Link')
->label( ->label(
fn( fn (
$row, $row,
Column $column Column $column
) => $row->homepage ? '<a target="_blank" class="underline text-amber-500" href="'.$this->url_to_absolute($row->homepage).'">Link</a>' : null ) => $row->homepage ? '<a target="_blank" class="underline text-amber-500" href="'.$this->url_to_absolute($row->homepage).'">Link</a>' : null
@@ -92,7 +89,7 @@ class BookCaseTable extends DataTableComponent
->html() ->html()
->collapseOnMobile(), ->collapseOnMobile(),
Column::make('Orange-Pilled', 'orange_pilled') Column::make('Orange-Pilled', 'orange_pilled')
->label(fn($row, Column $column) => view('columns.book_cases.oranged-pilled') ->label(fn ($row, Column $column) => view('columns.book_cases.oranged-pilled')
->withRow($row) ->withRow($row)
->withCountry($this->country)) ->withCountry($this->country))
->collapseOnMobile(), ->collapseOnMobile(),
@@ -104,7 +101,7 @@ class BookCaseTable extends DataTableComponent
if (str($url)->contains('http')) { if (str($url)->contains('http')) {
return $url; return $url;
} }
if (!str($url)->contains('http')) { if (! str($url)->contains('http')) {
return str($url)->prepend('https://'); return str($url)->prepend('https://');
} }
} }

View File

@@ -14,6 +14,7 @@ class CityTable extends DataTableComponent
use Actions; use Actions;
public string $country; public string $country;
public string $type; public string $type;
public string $tableName = 'cities'; public string $tableName = 'cities';
@@ -24,44 +25,44 @@ class CityTable extends DataTableComponent
->setAdditionalSelects(['id']) ->setAdditionalSelects(['id'])
->setThAttributes(function (Column $column) { ->setThAttributes(function (Column $column) {
return [ 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', '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, 'default' => false,
]; ];
}) })
->setTdAttributes(function (Column $column, $row, $columnIndex, $rowIndex) { ->setTdAttributes(function (Column $column, $row, $columnIndex, $rowIndex) {
return [ return [
'class' => 'px-6 py-4 text-sm font-medium dark:text-white', 'class' => 'px-6 py-4 text-sm font-medium dark:text-white',
'default' => false, 'default' => false,
]; ];
}) })
->setColumnSelectStatus(false) ->setColumnSelectStatus(false)
->setPerPage(10) ->setPerPage(10)
->setConfigurableAreas([ ->setConfigurableAreas([
'toolbar-left-end' => [ 'toolbar-left-end' => [
'columns.cities.areas.toolbar-left-end', [ 'columns.cities.areas.toolbar-left-end', [
'country' => $this->country, 'country' => $this->country,
], ],
], ],
]); ]);
} }
public function columns(): array public function columns(): array
{ {
$columns = collect([ $columns = collect([
Column::make("Stadt Name", "name") Column::make('Stadt Name', 'name')
->sortable() ->sortable()
->searchable(fn($builder, $term) => $builder->where('cities.name', 'ilike', '%'.$term.'%')), ->searchable(fn ($builder, $term) => $builder->where('cities.name', 'ilike', '%'.$term.'%')),
]); ]);
if ($this->type === 'school') { if ($this->type === 'school') {
$columns = $columns->merge([ $columns = $columns->merge([
Column::make('Veranstaltungs-Orte') Column::make('Veranstaltungs-Orte')
->label( ->label(
fn($row, Column $column) => $row->venues_count fn ($row, Column $column) => $row->venues_count
) )
->collapseOnMobile(), ->collapseOnMobile(),
Column::make('Termine') Column::make('Termine')
->label( ->label(
fn($row, Column $column) => $row->course_events_count fn ($row, Column $column) => $row->course_events_count
) )
->collapseOnMobile(), ->collapseOnMobile(),
]); ]);
@@ -70,7 +71,7 @@ class CityTable extends DataTableComponent
return $columns->merge([ return $columns->merge([
Column::make('') Column::make('')
->label( ->label(
fn($row, Column $column) => view('columns.cities.action') fn ($row, Column $column) => view('columns.cities.action')
->withRow($row) ->withRow($row)
->withType($this->type) ->withType($this->type)
), ),
@@ -85,7 +86,7 @@ class CityTable extends DataTableComponent
'venues', 'venues',
'courseEvents', 'courseEvents',
]) ])
->whereHas('country', fn($query) => $query->where('code', $this->country)) ->whereHas('country', fn ($query) => $query->where('code', $this->country))
->orderByDesc('course_events_count') ->orderByDesc('course_events_count')
->orderBy('cities.id'); ->orderBy('cities.id');
} }
@@ -96,16 +97,17 @@ class CityTable extends DataTableComponent
->find($id); ->find($id);
$query = City::radius($city->latitude, $city->longitude, 100) $query = City::radius($city->latitude, $city->longitude, 100)
->where('id', '!=', $id); ->where('id', '!=', $id);
return to_route('school.table.event', [ return to_route('school.table.event', [
'#table', '#table',
'country' => $this->country, 'country' => $this->country,
'course_events' => [ 'course_events' => [
'filters' => [ 'filters' => [
'stadt' => $query->pluck('name') 'stadt' => $query->pluck('name')
->push($city->name) ->push($city->name)
->implode(',') ->implode(','),
], ],
] ],
]); ]);
} }
@@ -118,17 +120,18 @@ class CityTable extends DataTableComponent
if ($ids->isEmpty()) { if ($ids->isEmpty()) {
$this->notification() $this->notification()
->error(__('No bookcases found in the radius of 5km')); ->error(__('No bookcases found in the radius of 5km'));
return; return;
} }
return to_route('bookCases.table.bookcases', [ return to_route('bookCases.table.bookcases', [
'#table', '#table',
'country' => $this->country, 'country' => $this->country,
'bookcases' => [ 'bookcases' => [
'filters' => [ 'filters' => [
'byids' => $ids->implode(',') 'byids' => $ids->implode(','),
], ],
] ],
]); ]);
} }
} }

View File

@@ -12,6 +12,7 @@ use Rappasoft\LaravelLivewireTables\Views\Filters\MultiSelectFilter;
class CourseTable extends DataTableComponent class CourseTable extends DataTableComponent
{ {
public string $country; public string $country;
public string $tableName = 'courses'; public string $tableName = 'courses';
public function configure(): void public function configure(): void
@@ -20,13 +21,13 @@ class CourseTable extends DataTableComponent
->setAdditionalSelects(['id']) ->setAdditionalSelects(['id'])
->setThAttributes(function (Column $column) { ->setThAttributes(function (Column $column) {
return [ 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', '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, 'default' => false,
]; ];
}) })
->setTdAttributes(function (Column $column, $row, $columnIndex, $rowIndex) { ->setTdAttributes(function (Column $column, $row, $columnIndex, $rowIndex) {
return [ return [
'class' => 'px-6 py-4 text-sm font-medium dark:text-white', 'class' => 'px-6 py-4 text-sm font-medium dark:text-white',
'default' => false, 'default' => false,
]; ];
}) })
@@ -42,7 +43,7 @@ class CourseTable extends DataTableComponent
Tag::query() Tag::query()
->withType('course') ->withType('course')
->get() ->get()
->mapWithKeys(fn($item, $key) => [$item->name => $item->name]) ->mapWithKeys(fn ($item, $key) => [$item->name => $item->name])
->toArray() ->toArray()
) )
->filter(function (Builder $builder, array $values) { ->filter(function (Builder $builder, array $values) {
@@ -54,33 +55,33 @@ class CourseTable extends DataTableComponent
public function columns(): array public function columns(): array
{ {
return [ return [
Column::make('Dozent', "lecturer.name") Column::make('Dozent', 'lecturer.name')
->label( ->label(
fn($row, Column $column) => view('columns.courses.lecturer')->withRow($row) fn ($row, Column $column) => view('columns.courses.lecturer')->withRow($row)
) )
->sortable() ->sortable()
->collapseOnMobile(), ->collapseOnMobile(),
Column::make("Name", "name") Column::make('Name', 'name')
->searchable(fn(Builder $query, string $term) => $query->where('name', 'ilike', '%'.$term.'%')) ->searchable(fn (Builder $query, string $term) => $query->where('name', 'ilike', '%'.$term.'%'))
->sortable(), ->sortable(),
Column::make("Tags") Column::make('Tags')
->label( ->label(
fn($row, Column $column) => view('columns.courses.tags')->withRow($row) fn ($row, Column $column) => view('columns.courses.tags')->withRow($row)
) )
->collapseOnMobile(), ->collapseOnMobile(),
Column::make("Termine") Column::make('Termine')
->label( ->label(
fn($row, Column $column) => '<strong>'.$row->course_events_count.'</strong>' fn ($row, Column $column) => '<strong>'.$row->course_events_count.'</strong>'
) )
->html() ->html()
->sortable() ->sortable()
->collapseOnMobile(), ->collapseOnMobile(),
Column::make("Erstellt am", "created_at") Column::make('Erstellt am', 'created_at')
->sortable() ->sortable()
->collapseOnMobile(), ->collapseOnMobile(),
Column::make('') Column::make('')
->label( ->label(
fn($row, Column $column) => view('columns.courses.action')->withRow($row) fn ($row, Column $column) => view('columns.courses.action')->withRow($row)
), ),
]; ];
} }
@@ -96,7 +97,7 @@ class CourseTable extends DataTableComponent
'courseEvents', 'courseEvents',
]) ])
->whereHas('courseEvents.venue.city.country', ->whereHas('courseEvents.venue.city.country',
fn($query) => $query->where('countries.code', $this->country)) fn ($query) => $query->where('countries.code', $this->country))
->orderByDesc('course_events_count') ->orderByDesc('course_events_count')
->orderBy('courses.id'); ->orderBy('courses.id');
} }
@@ -105,12 +106,12 @@ class CourseTable extends DataTableComponent
{ {
return to_route('school.table.event', [ return to_route('school.table.event', [
'#table', '#table',
'country' => $this->country, 'country' => $this->country,
'course_events' => [ 'course_events' => [
'filters' => [ 'filters' => [
'course_id' => $id, 'course_id' => $id,
], ],
] ],
]); ]);
} }
} }

View File

@@ -15,8 +15,11 @@ use Rappasoft\LaravelLivewireTables\Views\Filters\TextFilter;
class EventTable extends DataTableComponent class EventTable extends DataTableComponent
{ {
public string $country; public string $country;
public bool $viewingModal = false; public bool $viewingModal = false;
public $currentModal; public $currentModal;
public string $tableName = 'course_events'; public string $tableName = 'course_events';
public function configure(): void public function configure(): void
@@ -31,13 +34,13 @@ class EventTable extends DataTableComponent
]) ])
->setThAttributes(function (Column $column) { ->setThAttributes(function (Column $column) {
return [ 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', '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, 'default' => false,
]; ];
}) })
->setTdAttributes(function (Column $column, $row, $columnIndex, $rowIndex) { ->setTdAttributes(function (Column $column, $row, $columnIndex, $rowIndex) {
return [ return [
'class' => 'px-6 py-4 text-sm font-medium dark:text-white', 'class' => 'px-6 py-4 text-sm font-medium dark:text-white',
'default' => false, 'default' => false,
]; ];
}) })
@@ -66,7 +69,7 @@ class EventTable extends DataTableComponent
}); });
} else { } else {
$builder->whereHas('venue.city', $builder->whereHas('venue.city',
fn($query) => $query->where('cities.name', 'ilike', "%$value%")); fn ($query) => $query->where('cities.name', 'ilike', "%$value%"));
} }
}), }),
TextFilter::make(__('Venue'), 'venue') TextFilter::make(__('Venue'), 'venue')
@@ -75,7 +78,7 @@ class EventTable extends DataTableComponent
]) ])
->filter(function (Builder $builder, string $value) { ->filter(function (Builder $builder, string $value) {
$builder->whereHas('venue', $builder->whereHas('venue',
fn($query) => $query->where('venues.name', 'ilike', "%$value%")); fn ($query) => $query->where('venues.name', 'ilike', "%$value%"));
}), }),
TextFilter::make(__('Course')) TextFilter::make(__('Course'))
->config([ ->config([
@@ -83,13 +86,13 @@ class EventTable extends DataTableComponent
]) ])
->filter(function (Builder $builder, string $value) { ->filter(function (Builder $builder, string $value) {
$builder->whereHas('course', $builder->whereHas('course',
fn($query) => $query->where('courses.name', 'ilike', "%$value%")); fn ($query) => $query->where('courses.name', 'ilike', "%$value%"));
}), }),
TextFilter::make('Course by ID', 'course_id') TextFilter::make('Course by ID', 'course_id')
->hiddenFromMenus() ->hiddenFromMenus()
->filter(function (Builder $builder, string $value) { ->filter(function (Builder $builder, string $value) {
$builder->whereHas('course', $builder->whereHas('course',
fn($query) => $query->where('courses.id', '=', $value)); fn ($query) => $query->where('courses.id', '=', $value));
}), }),
MultiSelectFilter::make(__('Type')) MultiSelectFilter::make(__('Type'))
->options( ->options(
@@ -99,7 +102,7 @@ class EventTable extends DataTableComponent
) )
->filter(function (Builder $builder, array $values) { ->filter(function (Builder $builder, array $values) {
$builder->whereHas('course.categories', $builder->whereHas('course.categories',
fn($query) => $query->whereIn('categories.id', $values)); fn ($query) => $query->whereIn('categories.id', $values));
}), }),
SelectFilter::make(__('Lecturer')) SelectFilter::make(__('Lecturer'))
->options( ->options(
@@ -109,7 +112,7 @@ class EventTable extends DataTableComponent
) )
->filter(function (Builder $builder, string $value) { ->filter(function (Builder $builder, string $value) {
$builder->whereHas('course.lecturer', $builder->whereHas('course.lecturer',
fn($query) => $query->where('lecturers.id', $value)); fn ($query) => $query->where('lecturers.id', $value));
}), }),
]; ];
} }
@@ -117,33 +120,33 @@ class EventTable extends DataTableComponent
public function columns(): array public function columns(): array
{ {
return [ return [
Column::make(_('City'), "venue.city.name") Column::make(_('City'), 'venue.city.name')
->sortable() ->sortable()
->collapseOnMobile(), ->collapseOnMobile(),
Column::make(__('Venue'), "venue.name") Column::make(__('Venue'), 'venue.name')
->sortable() ->sortable()
->collapseOnMobile(), ->collapseOnMobile(),
Column::make(__('Lecturer'), "course.lecturer.name") Column::make(__('Lecturer'), 'course.lecturer.name')
->label( ->label(
fn($row, Column $column) => view('columns.events.lecturer')->withRow($row) fn ($row, Column $column) => view('columns.events.lecturer')->withRow($row)
) )
->sortable() ->sortable()
->collapseOnMobile(), ->collapseOnMobile(),
Column::make(__('Course'), "course.name") Column::make(__('Course'), 'course.name')
->sortable(), ->sortable(),
Column::make(__('Type')) Column::make(__('Type'))
->label( ->label(
fn($row, Column $column) => view('columns.events.categories')->withRow($row) fn ($row, Column $column) => view('columns.events.categories')->withRow($row)
) )
->collapseOnMobile(), ->collapseOnMobile(),
Column::make(__('From'), "from") Column::make(__('From'), 'from')
->format( ->format(
fn($value, $row, Column $column) => $value->asDateTime() fn ($value, $row, Column $column) => $value->asDateTime()
) )
->sortable(), ->sortable(),
Column::make(__('To'), "to") Column::make(__('To'), 'to')
->format( ->format(
fn($value, $row, Column $column) => $value->asDateTime() fn ($value, $row, Column $column) => $value->asDateTime()
) )
->sortable() ->sortable()
->collapseOnMobile(), ->collapseOnMobile(),
@@ -155,7 +158,7 @@ class EventTable extends DataTableComponent
->sortable(),*/ ->sortable(),*/
Column::make(__('Actions')) Column::make(__('Actions'))
->label( ->label(
fn($row, Column $column) => view('columns.events.action')->withRow($row) fn ($row, Column $column) => view('columns.events.action')->withRow($row)
) )
->collapseOnMobile(), ->collapseOnMobile(),
]; ];
@@ -170,7 +173,7 @@ class EventTable extends DataTableComponent
]) ])
->where('from', '>=', now()) ->where('from', '>=', now())
->whereHas('venue.city.country', ->whereHas('venue.city.country',
fn($query) => $query->where('countries.code', $this->country)); fn ($query) => $query->where('countries.code', $this->country));
} }
public function viewHistoryModal($modelId): void public function viewHistoryModal($modelId): void

View File

@@ -12,6 +12,7 @@ use Rappasoft\LaravelLivewireTables\Views\Columns\ImageColumn;
class LecturerTable extends DataTableComponent class LecturerTable extends DataTableComponent
{ {
public string $country; public string $country;
public string $tableName = 'lecturers'; public string $tableName = 'lecturers';
public function configure(): void public function configure(): void
@@ -20,13 +21,13 @@ class LecturerTable extends DataTableComponent
->setAdditionalSelects(['id']) ->setAdditionalSelects(['id'])
->setThAttributes(function (Column $column) { ->setThAttributes(function (Column $column) {
return [ 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', '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, 'default' => false,
]; ];
}) })
->setTdAttributes(function (Column $column, $row, $columnIndex, $rowIndex) { ->setTdAttributes(function (Column $column, $row, $columnIndex, $rowIndex) {
return [ return [
'class' => 'px-6 py-4 text-sm font-medium dark:text-white', 'class' => 'px-6 py-4 text-sm font-medium dark:text-white',
'default' => false, 'default' => false,
]; ];
}) })
@@ -39,32 +40,32 @@ class LecturerTable extends DataTableComponent
return [ return [
ImageColumn::make('Bild') ImageColumn::make('Bild')
->location( ->location(
fn($row) => $row->getFirstMediaUrl('avatar', 'thumb') fn ($row) => $row->getFirstMediaUrl('avatar', 'thumb')
) )
->attributes(fn($row) => [ ->attributes(fn ($row) => [
'class' => 'rounded h-16 w-16', 'class' => 'rounded h-16 w-16',
'alt' => $row->name.' Avatar', 'alt' => $row->name.' Avatar',
]) ])
->collapseOnMobile(), ->collapseOnMobile(),
Column::make("Name", "name") Column::make('Name', 'name')
->searchable(fn($query, $term) => $query->where('name', 'ilike', '%'.$term.'%')) ->searchable(fn ($query, $term) => $query->where('name', 'ilike', '%'.$term.'%'))
->sortable(), ->sortable(),
BooleanColumn::make("Aktiv", 'active') BooleanColumn::make('Aktiv', 'active')
->sortable() ->sortable()
->collapseOnMobile(), ->collapseOnMobile(),
Column::make('Kurse') Column::make('Kurse')
->label( ->label(
fn($row, Column $column) => $row->courses_count fn ($row, Column $column) => $row->courses_count
) )
->collapseOnMobile(), ->collapseOnMobile(),
Column::make('Inhalte') Column::make('Inhalte')
->label( ->label(
fn($row, Column $column) => $row->library_items_count fn ($row, Column $column) => $row->library_items_count
) )
->collapseOnMobile(), ->collapseOnMobile(),
Column::make('') Column::make('')
->label( ->label(
fn($row, Column $column) => view('columns.lectures.action') fn ($row, Column $column) => view('columns.lectures.action')
->withRow($row) ->withRow($row)
->withCountry($this->country) ->withCountry($this->country)
), ),
@@ -89,22 +90,22 @@ class LecturerTable extends DataTableComponent
if ($event) { if ($event) {
return to_route('school.table.event', [ return to_route('school.table.event', [
'#table', '#table',
'country' => $this->country, 'country' => $this->country,
'course_events' => [ 'course_events' => [
'filters' => [ 'filters' => [
'dozent' => $lecturer->id, 'dozent' => $lecturer->id,
], ],
] ],
]); ]);
} else { } else {
return to_route('library.table.libraryItems', [ return to_route('library.table.libraryItems', [
'#table', '#table',
'country' => $this->country, 'country' => $this->country,
'library_items' => [ 'library_items' => [
'filters' => [ 'filters' => [
'lecturer_id' => $lecturer->id, 'lecturer_id' => $lecturer->id,
], ],
] ],
]); ]);
} }
} }

View File

@@ -17,6 +17,7 @@ use Spatie\LaravelOptions\Options;
class LibraryItemTable extends DataTableComponent class LibraryItemTable extends DataTableComponent
{ {
public string $currentTab; public string $currentTab;
public string $tableName = 'library_items'; public string $tableName = 'library_items';
public function configure(): void public function configure(): void
@@ -27,13 +28,13 @@ class LibraryItemTable extends DataTableComponent
->setDefaultSort('order_column', 'asc') ->setDefaultSort('order_column', 'asc')
->setThAttributes(function (Column $column) { ->setThAttributes(function (Column $column) {
return [ 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', '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, 'default' => false,
]; ];
}) })
->setTdAttributes(function (Column $column, $row, $columnIndex, $rowIndex) { ->setTdAttributes(function (Column $column, $row, $columnIndex, $rowIndex) {
return [ return [
'class' => 'px-6 py-4 text-sm font-medium dark:text-white', 'class' => 'px-6 py-4 text-sm font-medium dark:text-white',
'default' => false, 'default' => false,
]; ];
}) })
@@ -88,7 +89,7 @@ class LibraryItemTable extends DataTableComponent
}); });
} else { } else {
$builder->whereHas('libraries', $builder->whereHas('libraries',
fn($query) => $query->where('libraries.name', 'ilike', "%$value%")); fn ($query) => $query->where('libraries.name', 'ilike', "%$value%"));
} }
}), }),
SelectFilter::make('Art') SelectFilter::make('Art')
@@ -97,7 +98,7 @@ class LibraryItemTable extends DataTableComponent
Options::forEnum(LibraryItemType::class) Options::forEnum(LibraryItemType::class)
->toArray() ->toArray()
) )
->mapWithKeys(fn($value, $key) => [$value['value'] => $value['label']]) ->mapWithKeys(fn ($value, $key) => [$value['value'] => $value['label']])
->prepend('*', '') ->prepend('*', '')
->toArray() ->toArray()
) )
@@ -115,18 +116,18 @@ class LibraryItemTable extends DataTableComponent
return [ return [
Column::make(__('Image')) Column::make(__('Image'))
->label( ->label(
fn($row, Column $column) => view('columns.library_items.image')->withRow($row) fn ($row, Column $column) => view('columns.library_items.image')->withRow($row)
) )
->collapseOnMobile(), ->collapseOnMobile(),
Column::make(__('Creator'), "lecturer.name") Column::make(__('Creator'), 'lecturer.name')
->label( ->label(
fn($row, Column $column) => view('columns.courses.lecturer')->withRow($row) fn ($row, Column $column) => view('columns.courses.lecturer')->withRow($row)
) )
->sortable() ->sortable()
->collapseOnMobile(), ->collapseOnMobile(),
Column::make("Name", "name") Column::make('Name', 'name')
->sortable(), ->sortable(),
Column::make("Art", "type") Column::make('Art', 'type')
->format( ->format(
function ($value, $row, Column $column) { function ($value, $row, Column $column) {
return '<span class="whitespace-nowrap inline-flex items-center rounded-full bg-amber-400 px-2.5 py-0.5 text-base font-medium text-gray-900"><i class="mr-2 fa fa-thin fa-' return '<span class="whitespace-nowrap inline-flex items-center rounded-full bg-amber-400 px-2.5 py-0.5 text-base font-medium text-gray-900"><i class="mr-2 fa fa-thin fa-'
@@ -138,14 +139,14 @@ class LibraryItemTable extends DataTableComponent
->html() ->html()
->sortable() ->sortable()
->collapseOnMobile(), ->collapseOnMobile(),
Column::make("Tags") Column::make('Tags')
->label( ->label(
fn($row, Column $column) => view('columns.library_items.tags')->withRow($row) fn ($row, Column $column) => view('columns.library_items.tags')->withRow($row)
) )
->collapseOnMobile(), ->collapseOnMobile(),
Column::make('') Column::make('')
->label( ->label(
fn($row, Column $column) => view('columns.library_items.action')->withRow($row) fn ($row, Column $column) => view('columns.library_items.action')->withRow($row)
), ),
]; ];
} }
@@ -167,14 +168,14 @@ class LibraryItemTable extends DataTableComponent
'lecturer', 'lecturer',
'tags', 'tags',
]) ])
->whereHas('libraries', fn($query) => $query->where('libraries.is_public', $shouldBePublic)) ->whereHas('libraries', fn ($query) => $query->where('libraries.is_public', $shouldBePublic))
->when($this->currentTab !== '*', fn($query) => $query ->when($this->currentTab !== '*', fn ($query) => $query
->whereHas('libraries', ->whereHas('libraries',
fn($query) => $query fn ($query) => $query
->where('libraries.name', $this->currentTab) ->where('libraries.name', $this->currentTab)
) )
->orWhereHas('libraries', ->orWhereHas('libraries',
fn($query) => $query fn ($query) => $query
->where('libraries.parent_id', $parentLibrary->id) ->where('libraries.parent_id', $parentLibrary->id)
) )
) )

View File

@@ -21,13 +21,13 @@ class MeetupEventTable extends DataTableComponent
->setDefaultSort('start', 'asc') ->setDefaultSort('start', 'asc')
->setThAttributes(function (Column $column) { ->setThAttributes(function (Column $column) {
return [ 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', '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, 'default' => false,
]; ];
}) })
->setTdAttributes(function (Column $column, $row, $columnIndex, $rowIndex) { ->setTdAttributes(function (Column $column, $row, $columnIndex, $rowIndex) {
return [ return [
'class' => 'px-6 py-4 text-sm font-medium dark:text-white', 'class' => 'px-6 py-4 text-sm font-medium dark:text-white',
'default' => false, 'default' => false,
]; ];
}) })
@@ -63,31 +63,31 @@ class MeetupEventTable extends DataTableComponent
$columns = [ $columns = [
Column::make(__('Meetup'), 'meetup.name') Column::make(__('Meetup'), 'meetup.name')
->format( ->format(
fn($value, $row, Column $column) => view('columns.meetup_events.name') fn ($value, $row, Column $column) => view('columns.meetup_events.name')
->withRow($row) ->withRow($row)
->withCountry($this->country) ->withCountry($this->country)
) )
->searchable(fn($builder, $term) => $builder->where('meetups.name', 'ilike', '%'.$term.'%')) ->searchable(fn ($builder, $term) => $builder->where('meetups.name', 'ilike', '%'.$term.'%'))
->sortable(), ->sortable(),
Column::make(__('Location'), 'location') Column::make(__('Location'), 'location')
->searchable(fn($builder, $term) => $builder->where('location', 'ilike', '%'.$term.'%')) ->searchable(fn ($builder, $term) => $builder->where('location', 'ilike', '%'.$term.'%'))
->sortable() ->sortable()
->collapseOnMobile(), ->collapseOnMobile(),
Column::make(__('Start'), 'start') Column::make(__('Start'), 'start')
->format( ->format(
fn($value, $row, Column $column) => $value->asDateTime() fn ($value, $row, Column $column) => $value->asDateTime()
) )
->sortable() ->sortable()
->collapseOnMobile(), ->collapseOnMobile(),
Column::make(__('Confirmations')) Column::make(__('Confirmations'))
->label( ->label(
fn($row, Column $column) => view('columns.meetup_events.confirmations') fn ($row, Column $column) => view('columns.meetup_events.confirmations')
->withRow($row) ->withRow($row)
) )
->collapseOnMobile(), ->collapseOnMobile(),
Column::make(__('Link')) Column::make(__('Link'))
->label( ->label(
fn($row, Column $column) => view('columns.meetup_events.link') fn ($row, Column $column) => view('columns.meetup_events.link')
->withRow($row) ->withRow($row)
) )
->collapseOnMobile(), ->collapseOnMobile(),
@@ -96,7 +96,7 @@ class MeetupEventTable extends DataTableComponent
$adminColumns = auth()->check() ? [ $adminColumns = auth()->check() ? [
Column::make(__('Actions')) Column::make(__('Actions'))
->label( ->label(
fn($row, Column $column) => view('columns.meetup_events.manage') fn ($row, Column $column) => view('columns.meetup_events.manage')
->withRow($row) ->withRow($row)
) )
->collapseOnMobile(), ->collapseOnMobile(),
@@ -109,7 +109,7 @@ class MeetupEventTable extends DataTableComponent
{ {
return MeetupEvent::query() return MeetupEvent::query()
->where('meetup_events.start', '>=', now()) ->where('meetup_events.start', '>=', now())
->whereHas('meetup.city.country', fn($query) => $query->where('code', $this->country)) ->whereHas('meetup.city.country', fn ($query) => $query->where('code', $this->country))
->with([ ->with([
'meetup.city.country', 'meetup.city.country',
]); ]);

View File

@@ -29,16 +29,16 @@ class MeetupForBtcMapTable extends DataTableComponent
public function columns(): array public function columns(): array
{ {
return [ return [
Column::make("Id", "id") Column::make('Id', 'id')
->sortable(), ->sortable(),
Column::make("Name", "name") Column::make('Name', 'name')
->sortable(), ->sortable(),
Column::make("City", "city.name") Column::make('City', 'city.name')
->sortable(), ->sortable(),
Column::make("Country", "city.country.name") Column::make('Country', 'city.country.name')
->sortable(), ->sortable(),
Column::make("Actions") Column::make('Actions')
->label(fn($row, Column $column) => view('columns.meetups.osm-actions', ['row' => $row])), ->label(fn ($row, Column $column) => view('columns.meetups.osm-actions', ['row' => $row])),
]; ];
} }

View File

@@ -11,6 +11,7 @@ use Rappasoft\LaravelLivewireTables\Views\Filters\TextFilter;
class MeetupTable extends DataTableComponent class MeetupTable extends DataTableComponent
{ {
public ?string $country = null; public ?string $country = null;
public string $tableName = 'meetups'; public string $tableName = 'meetups';
public function configure(): void public function configure(): void
@@ -19,13 +20,13 @@ class MeetupTable extends DataTableComponent
->setAdditionalSelects(['id', 'slug']) ->setAdditionalSelects(['id', 'slug'])
->setThAttributes(function (Column $column) { ->setThAttributes(function (Column $column) {
return [ 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', '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, 'default' => false,
]; ];
}) })
->setTdAttributes(function (Column $column, $row, $columnIndex, $rowIndex) { ->setTdAttributes(function (Column $column, $row, $columnIndex, $rowIndex) {
return [ return [
'class' => 'px-6 py-4 text-sm font-medium dark:text-white', 'class' => 'px-6 py-4 text-sm font-medium dark:text-white',
'default' => false, 'default' => false,
]; ];
}) })
@@ -49,16 +50,16 @@ class MeetupTable extends DataTableComponent
return [ return [
Column::make(__('Name'), 'name') Column::make(__('Name'), 'name')
->format( ->format(
fn($value, $row, Column $column) => view('columns.meetups.name') fn ($value, $row, Column $column) => view('columns.meetups.name')
->withRow($row) ->withRow($row)
) )
->searchable(fn($builder, $term) => $builder->where('meetups.name', 'ilike', '%'.$term.'%')), ->searchable(fn ($builder, $term) => $builder->where('meetups.name', 'ilike', '%'.$term.'%')),
Column::make(__('Plebs')) Column::make(__('Plebs'))
->label(fn($row, Column $column) => $row->users_count) ->label(fn ($row, Column $column) => $row->users_count)
->collapseOnMobile(), ->collapseOnMobile(),
Column::make(__('Links')) Column::make(__('Links'))
->label( ->label(
fn($row, Column $column) => view('columns.meetups.action') fn ($row, Column $column) => view('columns.meetups.action')
->withRow($row) ->withRow($row)
->withIcs(route('meetup.ics', ->withIcs(route('meetup.ics',
['country' => $this->country ?? $row->city->country->code, 'meetup' => $row->id])) ['country' => $this->country ?? $row->city->country->code, 'meetup' => $row->id]))
@@ -77,15 +78,15 @@ class MeetupTable extends DataTableComponent
'meetupEvents', 'meetupEvents',
]) ])
->when($this->country, ->when($this->country,
fn($query, $country) => $query->whereRelation('city.country', 'code', $this->country)) fn ($query, $country) => $query->whereRelation('city.country', 'code', $this->country))
->withCount([ ->withCount([
'users', 'users',
'meetupEvents' => fn($query) => $query->where('start', '>=', 'meetupEvents' => fn ($query) => $query->where('start', '>=',
now()), now()),
]) ])
->when(!$this->country, fn($query) => $query->orderByDesc('users_count') ->when(! $this->country, fn ($query) => $query->orderByDesc('users_count')
->orderBy('meetups.id')) ->orderBy('meetups.id'))
->when($this->country, fn($query) => $query->orderByDesc('meetup_events_count') ->when($this->country, fn ($query) => $query->orderByDesc('meetup_events_count')
->orderBy('meetups.id')); ->orderBy('meetups.id'));
} }
@@ -95,10 +96,10 @@ class MeetupTable extends DataTableComponent
->find($id); ->find($id);
return to_route('meetup.table.meetupEvent', [ return to_route('meetup.table.meetupEvent', [
'country' => $this->country ?? $meetup->city->country->code, 'country' => $this->country ?? $meetup->city->country->code,
'meetup_events' => [ 'meetup_events' => [
'filters' => ['bymeetupid' => $id], 'filters' => ['bymeetupid' => $id],
] ],
]); ]);
} }
} }

View File

@@ -20,13 +20,13 @@ class VenueTable extends DataTableComponent
->setAdditionalSelects(['id']) ->setAdditionalSelects(['id'])
->setThAttributes(function (Column $column) { ->setThAttributes(function (Column $column) {
return [ 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', '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, 'default' => false,
]; ];
}) })
->setTdAttributes(function (Column $column, $row, $columnIndex, $rowIndex) { ->setTdAttributes(function (Column $column, $row, $columnIndex, $rowIndex) {
return [ return [
'class' => 'px-6 py-4 text-sm font-medium dark:text-white', 'class' => 'px-6 py-4 text-sm font-medium dark:text-white',
'default' => false, 'default' => false,
]; ];
}) })
@@ -39,27 +39,27 @@ class VenueTable extends DataTableComponent
return [ return [
ImageColumn::make('Bild') ImageColumn::make('Bild')
->location( ->location(
fn($row) => $row->getFirstMediaUrl('images', 'thumb') fn ($row) => $row->getFirstMediaUrl('images', 'thumb')
) )
->attributes(fn($row) => [ ->attributes(fn ($row) => [
'class' => 'rounded h-16 w-16', 'class' => 'rounded h-16 w-16',
'alt' => $row->name.' Avatar', 'alt' => $row->name.' Avatar',
]) ])
->collapseOnMobile(), ->collapseOnMobile(),
Column::make("Name", "name") Column::make('Name', 'name')
->searchable(fn($query, $term) => $query->where('name', 'ilike', '%'.$term.'%')) ->searchable(fn ($query, $term) => $query->where('name', 'ilike', '%'.$term.'%'))
->sortable(), ->sortable(),
Column::make("Street", "street") Column::make('Street', 'street')
->sortable() ->sortable()
->collapseOnMobile(), ->collapseOnMobile(),
Column::make('Termine') Column::make('Termine')
->label( ->label(
fn($row, Column $column) => $row->course_events_count fn ($row, Column $column) => $row->course_events_count
) )
->collapseOnMobile(), ->collapseOnMobile(),
Column::make('') Column::make('')
->label( ->label(
fn($row, Column $column) => view('columns.venues.action')->withRow($row) fn ($row, Column $column) => view('columns.venues.action')->withRow($row)
), ),
]; ];
} }
@@ -70,7 +70,7 @@ class VenueTable extends DataTableComponent
->withCount([ ->withCount([
'courseEvents', 'courseEvents',
]) ])
->whereHas('city.country', fn($query) => $query->where('code', $this->country)) ->whereHas('city.country', fn ($query) => $query->where('code', $this->country))
->orderByDesc('course_events_count') ->orderByDesc('course_events_count')
->orderBy('venues.id'); ->orderBy('venues.id');
} }
@@ -82,12 +82,12 @@ class VenueTable extends DataTableComponent
return to_route('school.table.event', [ return to_route('school.table.event', [
'#table', '#table',
'country' => $this->country, 'country' => $this->country,
'course_events' => [ 'course_events' => [
'filters' => [ 'filters' => [
'venue' => $venue->name, 'venue' => $venue->name,
], ],
] ],
]); ]);
} }
} }

View File

@@ -15,16 +15,15 @@ class CustomEnsureEmailVerified
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next * @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
*
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse * @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
*/ */
public function handle(Request $request, Closure $next, $redirectToRoute = null) public function handle(Request $request, Closure $next, $redirectToRoute = null)
{ {
if (!$request->user() || if (! $request->user() ||
( (
$request->user() instanceof MustVerifyEmail $request->user() instanceof MustVerifyEmail
&& !$request->user()->public_key && ! $request->user()->public_key
&& !$request->user() && ! $request->user()
->hasVerifiedEmail() ->hasVerifiedEmail()
) )
) { ) {

View File

@@ -4,8 +4,6 @@ namespace App\Http\Middleware;
use Closure; use Closure;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Cookie;
class NeedMeetupMiddleware class NeedMeetupMiddleware
{ {
@@ -14,7 +12,6 @@ class NeedMeetupMiddleware
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next * @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
*
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse * @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
*/ */
public function handle(Request $request, Closure $next) public function handle(Request $request, Closure $next)

View File

@@ -14,7 +14,6 @@ class SetTimezoneForNovaMiddleware
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next * @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
*
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse * @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
*/ */
public function handle(Request $request, Closure $next) public function handle(Request $request, Closure $next)

View File

@@ -14,7 +14,6 @@ class SetTimezoneMiddleware
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next * @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
*
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse * @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
*/ */
public function handle(Request $request, Closure $next) public function handle(Request $request, Closure $next)
@@ -24,14 +23,14 @@ class SetTimezoneMiddleware
&& $timezone = $request->user()->timezone && $timezone = $request->user()->timezone
) { ) {
config([ config([
'app.timezone' => $timezone, 'app.timezone' => $timezone,
'app.user-timezone' => $timezone, 'app.user-timezone' => $timezone,
]); ]);
return $next($request); return $next($request);
} }
config([ config([
'app.timezone' => 'Europe/Berlin', 'app.timezone' => 'Europe/Berlin',
'app.user-timezone' => 'Europe/Berlin', 'app.user-timezone' => 'Europe/Berlin',
]); ]);

View File

@@ -9,6 +9,7 @@ class AddLoginReputation
{ {
/** /**
* Create the event listener. * Create the event listener.
*
* @return void * @return void
*/ */
public function __construct() public function __construct()
@@ -20,7 +21,6 @@ class AddLoginReputation
* Handle the event. * Handle the event.
* *
* @param object $event * @param object $event
*
* @return void * @return void
*/ */
public function handle($event) public function handle($event)

View File

@@ -17,25 +17,27 @@ class BitcoinEvent extends Model implements HasMedia
/** /**
* The attributes that aren't mass assignable. * The attributes that aren't mass assignable.
*
* @var array * @var array
*/ */
protected $guarded = []; protected $guarded = [];
/** /**
* The attributes that should be cast to native types. * The attributes that should be cast to native types.
*
* @var array * @var array
*/ */
protected $casts = [ protected $casts = [
'id' => 'integer', 'id' => 'integer',
'venue_id' => 'integer', 'venue_id' => 'integer',
'from' => 'datetime', 'from' => 'datetime',
'to' => 'datetime', 'to' => 'datetime',
]; ];
protected static function booted() protected static function booted()
{ {
static::creating(function ($model) { static::creating(function ($model) {
if (!$model->created_by) { if (! $model->created_by) {
$model->created_by = auth()->id(); $model->created_by = auth()->id();
} }
}); });

View File

@@ -3,7 +3,6 @@
namespace App\Models; namespace App\Models;
use Akuechler\Geoly; use Akuechler\Geoly;
use App\Models\Scopes\ActiveBookCases;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;
@@ -23,26 +22,28 @@ class BookCase extends Model implements HasMedia
/** /**
* The attributes that aren't mass assignable. * The attributes that aren't mass assignable.
*
* @var array * @var array
*/ */
protected $guarded = []; protected $guarded = [];
/** /**
* The attributes that should be cast to native types. * The attributes that should be cast to native types.
*
* @var array * @var array
*/ */
protected $casts = [ protected $casts = [
'id' => 'integer', 'id' => 'integer',
'lat' => 'double', 'lat' => 'double',
'lon' => 'array', 'lon' => 'array',
'digital' => 'boolean', 'digital' => 'boolean',
'deactivated' => 'boolean', 'deactivated' => 'boolean',
]; ];
protected static function booted() protected static function booted()
{ {
static::creating(function ($model) { static::creating(function ($model) {
if (!$model->created_by) { if (! $model->created_by) {
$model->created_by = auth()->id(); $model->created_by = auth()->id();
} }
}); });

View File

@@ -12,12 +12,14 @@ class Category extends Model
/** /**
* The attributes that aren't mass assignable. * The attributes that aren't mass assignable.
*
* @var array * @var array
*/ */
protected $guarded = []; protected $guarded = [];
/** /**
* The attributes that should be cast to native types. * The attributes that should be cast to native types.
*
* @var array * @var array
*/ */
protected $casts = [ protected $casts = [

View File

@@ -19,25 +19,27 @@ class City extends Model
/** /**
* The attributes that aren't mass assignable. * The attributes that aren't mass assignable.
*
* @var array * @var array
*/ */
protected $guarded = []; protected $guarded = [];
/** /**
* The attributes that should be cast to native types. * The attributes that should be cast to native types.
*
* @var array * @var array
*/ */
protected $casts = [ protected $casts = [
'id' => 'integer', 'id' => 'integer',
'country_id' => 'integer', 'country_id' => 'integer',
'osm_relation' => 'json', 'osm_relation' => 'json',
'simplified_geojson' => 'json', 'simplified_geojson' => 'json',
]; ];
protected static function booted() protected static function booted()
{ {
static::creating(function ($model) { static::creating(function ($model) {
if (!$model->created_by) { if (! $model->created_by) {
$model->created_by = auth()->id(); $model->created_by = auth()->id();
} }
}); });
@@ -69,12 +71,12 @@ class City extends Model
return $this->hasMany(Venue::class); return $this->hasMany(Venue::class);
} }
function courseEvents() public function courseEvents()
{ {
return $this->hasManyThrough(CourseEvent::class, Venue::class); return $this->hasManyThrough(CourseEvent::class, Venue::class);
} }
function meetups() public function meetups()
{ {
return $this->hasMany(Meetup::class); return $this->hasMany(Meetup::class);
} }

View File

@@ -12,16 +12,18 @@ class Country extends Model
/** /**
* The attributes that aren't mass assignable. * The attributes that aren't mass assignable.
*
* @var array * @var array
*/ */
protected $guarded = []; protected $guarded = [];
/** /**
* The attributes that should be cast to native types. * The attributes that should be cast to native types.
*
* @var array * @var array
*/ */
protected $casts = [ protected $casts = [
'id' => 'integer', 'id' => 'integer',
'language_codes' => 'array', 'language_codes' => 'array',
]; ];

View File

@@ -21,23 +21,25 @@ class Course extends Model implements HasMedia
/** /**
* The attributes that aren't mass assignable. * The attributes that aren't mass assignable.
*
* @var array * @var array
*/ */
protected $guarded = []; protected $guarded = [];
/** /**
* The attributes that should be cast to native types. * The attributes that should be cast to native types.
*
* @var array * @var array
*/ */
protected $casts = [ protected $casts = [
'id' => 'integer', 'id' => 'integer',
'lecturer_id' => 'integer', 'lecturer_id' => 'integer',
]; ];
protected static function booted() protected static function booted()
{ {
static::creating(function ($model) { static::creating(function ($model) {
if (!$model->created_by) { if (! $model->created_by) {
$model->created_by = auth()->id(); $model->created_by = auth()->id();
} }
}); });

View File

@@ -13,26 +13,28 @@ class CourseEvent extends Model
/** /**
* The attributes that aren't mass assignable. * The attributes that aren't mass assignable.
*
* @var array * @var array
*/ */
protected $guarded = []; protected $guarded = [];
/** /**
* The attributes that should be cast to native types. * The attributes that should be cast to native types.
*
* @var array * @var array
*/ */
protected $casts = [ protected $casts = [
'id' => 'integer', 'id' => 'integer',
'course_id' => 'integer', 'course_id' => 'integer',
'venue_id' => 'integer', 'venue_id' => 'integer',
'from' => 'datetime', 'from' => 'datetime',
'to' => 'datetime', 'to' => 'datetime',
]; ];
protected static function booted() protected static function booted()
{ {
static::creating(function ($model) { static::creating(function ($model) {
if (!$model->created_by) { if (! $model->created_by) {
$model->created_by = auth()->id(); $model->created_by = auth()->id();
} }
}); });

View File

@@ -15,24 +15,26 @@ class Episode extends Model
/** /**
* The attributes that aren't mass assignable. * The attributes that aren't mass assignable.
*
* @var array * @var array
*/ */
protected $guarded = []; protected $guarded = [];
/** /**
* The attributes that should be cast to native types. * The attributes that should be cast to native types.
*
* @var array * @var array
*/ */
protected $casts = [ protected $casts = [
'id' => 'integer', 'id' => 'integer',
'podcast_id' => 'integer', 'podcast_id' => 'integer',
'data' => 'array', 'data' => 'array',
]; ];
protected static function booted() protected static function booted()
{ {
static::creating(function ($model) { static::creating(function ($model) {
if (!$model->created_by) { if (! $model->created_by) {
$model->created_by = auth()->id(); $model->created_by = auth()->id();
} }
}); });

View File

@@ -23,26 +23,29 @@ class Lecturer extends Model implements HasMedia
/** /**
* The attributes that aren't mass assignable. * The attributes that aren't mass assignable.
*
* @var array * @var array
*/ */
protected $guarded = []; protected $guarded = [];
/** /**
* The attributes that should be cast to native types. * The attributes that should be cast to native types.
*
* @var array * @var array
*/ */
protected $casts = [ protected $casts = [
'id' => 'integer', 'id' => 'integer',
'team_id' => 'integer', 'team_id' => 'integer',
'active' => 'boolean', 'active' => 'boolean',
]; ];
protected static function booted() protected static function booted()
{ {
static::creating(function ($model) { static::creating(function ($model) {
if (!$model->created_by) { if (! $model->created_by) {
$model->created_by = auth()->id(); $model->created_by = auth()->id();
} }
if (!$model->team_id) { if (! $model->team_id) {
$model->team_id = auth()->user()->current_team_id; $model->team_id = auth()->user()->current_team_id;
} }
}); });

View File

@@ -6,7 +6,6 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Library extends Model class Library extends Model
{ {
@@ -14,23 +13,25 @@ class Library extends Model
/** /**
* The attributes that aren't mass assignable. * The attributes that aren't mass assignable.
*
* @var array * @var array
*/ */
protected $guarded = []; protected $guarded = [];
/** /**
* The attributes that should be cast to native types. * The attributes that should be cast to native types.
*
* @var array * @var array
*/ */
protected $casts = [ protected $casts = [
'id' => 'integer', 'id' => 'integer',
'language_codes' => 'array', 'language_codes' => 'array',
]; ];
protected static function booted() protected static function booted()
{ {
static::creating(function ($model) { static::creating(function ($model) {
if (!$model->created_by) { if (! $model->created_by) {
$model->created_by = auth()->id(); $model->created_by = auth()->id();
} }
}); });
@@ -46,7 +47,7 @@ class Library extends Model
return $this->belongsToMany(LibraryItem::class); return $this->belongsToMany(LibraryItem::class);
} }
public function parent() : BelongsTo public function parent(): BelongsTo
{ {
return $this->belongsTo(__CLASS__, 'parent_id'); return $this->belongsTo(__CLASS__, 'parent_id');
} }

View File

@@ -31,18 +31,20 @@ class LibraryItem extends Model implements HasMedia, Sortable, Feedable
/** /**
* The attributes that aren't mass assignable. * The attributes that aren't mass assignable.
*
* @var array * @var array
*/ */
protected $guarded = []; protected $guarded = [];
/** /**
* The attributes that should be cast to native types. * The attributes that should be cast to native types.
*
* @var array * @var array
*/ */
protected $casts = [ protected $casts = [
'id' => 'integer', 'id' => 'integer',
'lecturer_id' => 'integer', 'lecturer_id' => 'integer',
'library_id' => 'integer', 'library_id' => 'integer',
]; ];
public static function getFeedItems() public static function getFeedItems()
@@ -61,7 +63,7 @@ class LibraryItem extends Model implements HasMedia, Sortable, Feedable
protected static function booted() protected static function booted()
{ {
static::creating(function ($model) { static::creating(function ($model) {
if (!$model->created_by) { if (! $model->created_by) {
$model->created_by = auth()->id(); $model->created_by = auth()->id();
} }
}); });
@@ -95,7 +97,7 @@ class LibraryItem extends Model implements HasMedia, Sortable, Feedable
$this->addMediaCollection('single_file') $this->addMediaCollection('single_file')
->acceptsMimeTypes([ ->acceptsMimeTypes([
'application/pdf', 'application/zip', 'application/octet-stream', 'application/x-zip-compressed', 'application/pdf', 'application/zip', 'application/octet-stream', 'application/x-zip-compressed',
'multipart/x-zip' 'multipart/x-zip',
]) ])
->singleFile(); ->singleFile();
$this->addMediaCollection('images') $this->addMediaCollection('images')

View File

@@ -11,12 +11,14 @@ class LoginKey extends Model
/** /**
* The attributes that aren't mass assignable. * The attributes that aren't mass assignable.
*
* @var array * @var array
*/ */
protected $guarded = []; protected $guarded = [];
/** /**
* The attributes that should be cast to native types. * The attributes that should be cast to native types.
*
* @var array * @var array
*/ */
protected $casts = []; protected $casts = [];

View File

@@ -23,24 +23,27 @@ class Meetup extends Model implements HasMedia
/** /**
* The attributes that aren't mass assignable. * The attributes that aren't mass assignable.
*
* @var array * @var array
*/ */
protected $guarded = []; protected $guarded = [];
/** /**
* The attributes that should be cast to native types. * The attributes that should be cast to native types.
*
* @var array * @var array
*/ */
protected $casts = [ protected $casts = [
'id' => 'integer', 'id' => 'integer',
'city_id' => 'integer', 'city_id' => 'integer',
'github_data' => 'json', 'github_data' => 'json',
'simplified_geojson' => 'array', 'simplified_geojson' => 'array',
]; ];
protected static function booted() protected static function booted()
{ {
static::creating(function ($model) { static::creating(function ($model) {
if (!$model->created_by) { if (! $model->created_by) {
$model->created_by = auth()->id(); $model->created_by = auth()->id();
} }
}); });
@@ -103,13 +106,13 @@ class Meetup extends Model implements HasMedia
} }
return Attribute::make( return Attribute::make(
get: fn() => url()->route('img', get: fn () => url()->route('img',
[ [
'path' => $path, 'path' => $path,
'w' => 900, 'w' => 900,
'h' => 900, 'h' => 900,
'fit' => 'crop', 'fit' => 'crop',
'fm' => 'webp' 'fm' => 'webp',
]), ]),
); );
} }

View File

@@ -14,26 +14,28 @@ class MeetupEvent extends Model
/** /**
* The attributes that aren't mass assignable. * The attributes that aren't mass assignable.
*
* @var array * @var array
*/ */
protected $guarded = []; protected $guarded = [];
/** /**
* The attributes that should be cast to native types. * The attributes that should be cast to native types.
*
* @var array * @var array
*/ */
protected $casts = [ protected $casts = [
'id' => 'integer', 'id' => 'integer',
'meetup_id' => 'integer', 'meetup_id' => 'integer',
'start' => 'datetime', 'start' => 'datetime',
'attendees' => 'array', 'attendees' => 'array',
'might_attendees' => 'array', 'might_attendees' => 'array',
]; ];
protected static function booted() protected static function booted()
{ {
static::creating(function ($model) { static::creating(function ($model) {
if (!$model->created_by) { if (! $model->created_by) {
$model->created_by = auth()->id(); $model->created_by = auth()->id();
} }
}); });
@@ -64,6 +66,6 @@ class MeetupEvent extends Model
*/ */
public function commentUrl(): string public function commentUrl(): string
{ {
return url()->route('meetup.event.landing', ['country' => $this->meetup->city->country,'meetupEvent' => $this]); return url()->route('meetup.event.landing', ['country' => $this->meetup->city->country, 'meetupEvent' => $this]);
} }
} }

View File

@@ -8,6 +8,7 @@ class Membership extends JetstreamMembership
{ {
/** /**
* Indicates if the IDs are auto-incrementing. * Indicates if the IDs are auto-incrementing.
*
* @var bool * @var bool
*/ */
public $incrementing = true; public $incrementing = true;

View File

@@ -18,19 +18,21 @@ class OrangePill extends Model implements HasMedia
/** /**
* The attributes that aren't mass assignable. * The attributes that aren't mass assignable.
*
* @var array * @var array
*/ */
protected $guarded = []; protected $guarded = [];
/** /**
* The attributes that should be cast to native types. * The attributes that should be cast to native types.
*
* @var array * @var array
*/ */
protected $casts = [ protected $casts = [
'id' => 'integer', 'id' => 'integer',
'user_id' => 'integer', 'user_id' => 'integer',
'book_case_id' => 'integer', 'book_case_id' => 'integer',
'date' => 'datetime', 'date' => 'datetime',
]; ];
protected static function booted() protected static function booted()

View File

@@ -11,12 +11,14 @@ class Participant extends Model
/** /**
* The attributes that aren't mass assignable. * The attributes that aren't mass assignable.
*
* @var array * @var array
*/ */
protected $guarded = []; protected $guarded = [];
/** /**
* The attributes that should be cast to native types. * The attributes that should be cast to native types.
*
* @var array * @var array
*/ */
protected $casts = [ protected $casts = [

View File

@@ -13,23 +13,25 @@ class Podcast extends Model
/** /**
* The attributes that aren't mass assignable. * The attributes that aren't mass assignable.
*
* @var array * @var array
*/ */
protected $guarded = []; protected $guarded = [];
/** /**
* The attributes that should be cast to native types. * The attributes that should be cast to native types.
*
* @var array * @var array
*/ */
protected $casts = [ protected $casts = [
'id' => 'integer', 'id' => 'integer',
'data' => 'array', 'data' => 'array',
]; ];
protected static function booted() protected static function booted()
{ {
static::creating(function ($model) { static::creating(function ($model) {
if (!$model->created_by) { if (! $model->created_by) {
$model->created_by = auth()->id(); $model->created_by = auth()->id();
} }
}); });

Some files were not shown because too many files have changed in this diff Show More