lasthourcloud/app/Console/Commands/NotifyDemo.php

80 lines
1.9 KiB
PHP
Raw Normal View History

2023-05-25 16:27:52 +00:00
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
2024-06-10 20:43:34 +00:00
2023-05-25 16:27:52 +00:00
use function Termwind\ask;
use function Termwind\render;
use function Termwind\style;
class NotifyDemo extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'app:demo-notify {channel?}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Send a demo notification, to a given channel. Run to see options.';
/**
* Execute the console command.
*/
public function handle()
{
$channel = $this->argument('channel');
if (blank($channel)) {
$this->showHelp();
2024-06-10 20:43:34 +00:00
2023-05-25 16:27:52 +00:00
return;
}
ray($channel);
}
private function showHelp()
{
style('coolify')->color('#9333EA');
style('title-box')->apply('mt-1 px-2 py-1 bg-coolify');
2023-08-11 18:48:52 +00:00
render(
<<<'HTML'
2023-05-25 16:27:52 +00:00
<div>
<div class="title-box">
2024-07-25 20:50:18 +00:00
Last Hour Cloud
2023-05-25 16:27:52 +00:00
</div>
2023-08-11 18:48:52 +00:00
<p class="mt-1 ml-1 ">
2023-05-25 16:27:52 +00:00
Demo Notify <strong class="text-coolify">=></strong> Send a demo notification to a given channel.
</p>
2023-08-11 18:48:52 +00:00
<p class="px-1 mt-1 ml-1 bg-coolify">
2023-05-25 16:27:52 +00:00
php artisan app:demo-notify {channel}
</p>
<div class="my-1">
<div class="text-yellow-500"> Channels: </div>
<ul class="text-coolify">
<li>email</li>
<li>slack</li>
<li>discord</li>
<li>telegram</li>
</ul>
</div>
</div>
HTML
);
2023-05-25 16:27:52 +00:00
ask(<<<'HTML'
<div class="mr-1">
2024-07-25 20:50:18 +00:00
In which manner you wish a <strong class="text-coolify">Last Hour Cloud</strong> notification?
2023-05-25 16:27:52 +00:00
</div>
HTML, ['email', 'slack', 'discord', 'telegram']);
}
}