I created an artisan command using this command:
php artisan make:command --command=custom:command SomeCustomCommand
After I ran the command it created the file below:
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class SomeCustomCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'custom:command';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
return 0;
}
}
I noticed that by default the handle method returns an int. Does this mean something? If I return 0 it mean error then 1 if success? I'm browsing the laravel documentation and it doesn't explain what should be the return of the handle function.