laravel use controller in command code example
Example 1: laravel create controller command
php artisan make:controller UserController
Example 2: laravel run controller from command line
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Http\Controllers\HelloWorldController;
class MakeImportsCommand extends Command
{
protected $signature = 'helloworld';
protected $description = 'Say Hello World Controller';
public function __construct()
{
parent::__construct();
}
public function handle()
{
return $this -> helloWorld();
}
}