Archived
1
0
Fork 0

Initial Commit

This commit is contained in:
Henrik Hautakoski 2021-10-18 11:53:33 +02:00
commit ddf09fe00c
113 changed files with 187148 additions and 0 deletions

View file

@ -0,0 +1,52 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Models\Character;
use App\Models\Raid;
use App\Models\Card;
use Illuminate\Support\Str;
class CardExport extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'card:export';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Export card data';
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$data = collect();
foreach(Card::with(['character', 'raid'])->get() as $card) {
$row = collect([
'message' => $card->body,
'character' => $card->character ? $card->character->name : null,
'raid' => $card->raid ? $card->raid->name : null,
'class' => $card->class,
'role' => $card->role
])->filter()->toArray();
$data->push($row);
}
$this->line($data->toJson(JSON_PRETTY_PRINT));
}
}