Archived
1
0
Fork 0
This repository has been archived on 2021-07-30. You can view files and clone it, but cannot push or open issues or pull requests.
ifnews/app/Commands/Wiki.php

47 lines
798 B
PHP

<?php
namespace App\Commands;
use LaravelZero\Framework\Commands\Command;
use Log;
use App\Models\Game;
use App\Wikipage;
class Wiki extends Command
{
/**
* The signature of the command.
*
* @var string
*/
protected $signature = 'wiki {id}';
/**
* The description of the command.
*
* @var string
*/
protected $description = 'Make a Mediawiki article about a game #ID';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$id = $this->argument('id');
if (!is_numeric($id)) {
Log::error('ID should be numeric.');
return;
}
$game = Game::where('id', $id)->first();
if (!isset($game)) {
Log::error('Game not found.');
return;
}
$page = new Wikipage($game);
$page->create();
}
}