Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reg flag cmd #5

Merged
merged 3 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions app/Console/Commands/RegistrationSubmitDataCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

namespace App\Console\Commands;

use App\Models\User;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Http;

class RegistrationSubmitDataCommand extends Command
{
protected $signature = 'registration:submit-data';

protected $description = 'Submit data to the registration service';

public function handle(): void
{
$this->info('Submitting data to the registration service...');
// Go trough all users that have a regid
// and submit the data to the registration service
User::lazy(100)->each(function (User $user) {
$this->info("Submitting data for user {$user->id}");
// Submit data to the registration service
Http::attsrv()
->asJson()
->withCookies([
'AUTH' => config('services.attsrv.cookies.AUTH'),
'JWT' => config('services.attsrv.cookies.JWT'),
],config('services.attsrv.cookies.domain'))
->post('/attendees/'.$user->attendee_id.'/additional-info/fursuitbadge',[
'has_fursuit_badge' => $user->badges()->exists(),
]);
// Get and dd
$response = Http::attsrv()
->asJson()
->withCookies([
'AUTH' => config('services.attsrv.cookies.AUTH'),
'JWT' => config('services.attsrv.cookies.JWT'),
],config('services.attsrv.cookies.domain'))
->throw()
->get('/attendees/'.$user->attendee_id.'/additional-info/fursuitbadge');
// Return info
dump($response->json());
});
}
}
6 changes: 6 additions & 0 deletions config/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@

'attsrv' => [
'url' => env('ATTSRV_URL'),
/** I HATE THIS I HATE THIS I HATE THIS */
'cookies' => [
'AUTH' => env('ATTSRV_AUTH_COOKIE'),
'JWT' => env('ATTSRV_JWT_COOKIE'),
'domain' => env('ATTSRV_COOKIE_DOMAIN'),
],
],

];
Loading