40 lines
710 B
PHP
40 lines
710 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Console\Commands;
|
||
|
|
||
|
use Illuminate\Console\Command;
|
||
|
use App\Models\Regions;
|
||
|
|
||
|
class scraperAddRegion extends Command
|
||
|
{
|
||
|
/**
|
||
|
* The name and signature of the console command.
|
||
|
*
|
||
|
* @var string
|
||
|
*/
|
||
|
protected $signature = 'scraper:add-region {name}';
|
||
|
|
||
|
/**
|
||
|
* The console command description.
|
||
|
*
|
||
|
* @var string
|
||
|
*/
|
||
|
protected $description = 'Add new region to database.';
|
||
|
|
||
|
/**
|
||
|
* Execute the console command.
|
||
|
*/
|
||
|
public function handle()
|
||
|
{
|
||
|
|
||
|
$name = $this->argument('name');
|
||
|
|
||
|
$region = Regions::create([
|
||
|
'name' => $name
|
||
|
]);
|
||
|
|
||
|
$this->info('New Region created '.$region);
|
||
|
|
||
|
}
|
||
|
}
|