36 lines
687 B
PHP
36 lines
687 B
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Models\Word;
|
|
use Illuminate\Console\Command;
|
|
|
|
class AddWordCommand extends Command
|
|
{
|
|
/**
|
|
* The name and signature of the console command.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $signature = 'addword {word} {type}';
|
|
|
|
/**
|
|
* The console command description.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $description = 'Add a word to the database';
|
|
|
|
/**
|
|
* Execute the console command.
|
|
*
|
|
* @return mixed
|
|
*/
|
|
public function handle()
|
|
{
|
|
$row = new Word;
|
|
$row->value = $this->argument('word');
|
|
$row->type = $this->argument('type');
|
|
$row->save();
|
|
}
|
|
}
|