40 lines
1.4 KiB
PHP
40 lines
1.4 KiB
PHP
<?php
|
|
require __DIR__ . '/../vendor/autoload.php';
|
|
$app = require_once __DIR__ . '/../bootstrap/app.php';
|
|
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
|
$kernel->bootstrap();
|
|
|
|
$interns = \App\Models\CareerApplication::where('status', 'accepted')
|
|
->with(['journalEntries' => function($q) {
|
|
$q->orderBy('date', 'asc');
|
|
}])
|
|
->get();
|
|
|
|
$data = [];
|
|
foreach ($interns as $intern) {
|
|
$entries = [];
|
|
foreach ($intern->journalEntries as $entry) {
|
|
$entries[] = [
|
|
'day_number' => $entry->day_number,
|
|
'date' => $entry->date,
|
|
'content' => $entry->content,
|
|
'is_retroactive' => $entry->is_retroactive,
|
|
'supervisor_approved' => $entry->supervisor_approved,
|
|
'unit_approved' => $entry->unit_approved,
|
|
];
|
|
}
|
|
$data[] = [
|
|
'id' => $intern->id,
|
|
'name' => $intern->name,
|
|
'email' => $intern->email,
|
|
'github_username' => $intern->github_username,
|
|
'github_repo' => $intern->github_repo,
|
|
'internship_start_date' => $intern->internship_start_date,
|
|
'internship_end_date' => $intern->internship_end_date,
|
|
'journal_entries' => $entries,
|
|
];
|
|
}
|
|
|
|
file_put_contents(__DIR__ . '/intern_data.json', json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
|
|
echo "Done! Saved to scratch/intern_data.json\n";
|