1If you have simple job to do you can do it from route file.
2For example you want to clear cache. In terminal it would be php artisan
3cache:clear In route file that would be:
4
5\Artisan::call('cache:clear');
1<?php
2Route::get('/foo', function () {
3 Artisan::queue('email:send', [
4 'user' => 1, '--queue' => 'default'
5 ]);
6 //
7});
1 <?php
2
3namespace App\Console\Commands;
4
5use Illuminate\Console\Command;
6use App\Http\Controllers\HelloWorldController;
7
8class MakeImportsCommand extends Command
9{
10 /**
11 * The name and signature of the console command.
12 *
13 * @var string
14 */
15 protected $signature = 'helloworld';
16
17 /**
18 * The console command description.
19 *
20 * @var string
21 */
22 protected $description = 'Say Hello World Controller';
23
24 /**
25 * Create a new command instance.
26 *
27 * @return void
28 */
29 public function __construct()
30 {
31 parent::__construct();
32 }
33
34 /**
35 * Execute the console command.
36 *
37 * @return mixed
38 */
39 public function handle()
40 {
41 return $this -> helloWorld();
42
43 }
44}
45