2021-06-05 09:26:32 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
|
|
|
|
use App\Models\Server;
|
|
|
|
use App\Models\User;
|
|
|
|
use App\Notifications\ServerCreationError;
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
|
|
|
|
class notify extends Command
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The name and signature of the console command.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $signature = 'notify:user {id}';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The console command description.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $description = 'Send test notifications to this user';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new command instance.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Execute the console command.
|
|
|
|
*
|
2023-01-05 17:01:42 +00:00
|
|
|
* @param int $id
|
2021-06-05 09:26:32 +00:00
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
public function handle()
|
|
|
|
{
|
|
|
|
User::findOrFail($this->argument('id'))->notify(new ServerCreationError(Server::all()[0]));
|
2023-01-05 17:01:42 +00:00
|
|
|
|
2021-06-05 09:26:32 +00:00
|
|
|
return 'message send';
|
|
|
|
}
|
|
|
|
}
|