2022-12-04 02:30:38 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
use Illuminate\Support\Facades\Notification;
|
|
|
|
|
|
|
|
use App\Models\{Address,User};
|
2023-07-23 07:27:52 +00:00
|
|
|
use App\Notifications\Netmails\AddressLink;
|
2022-12-04 02:30:38 +00:00
|
|
|
|
|
|
|
class UserCodeSend extends Command
|
|
|
|
{
|
|
|
|
protected $signature = 'user:code:send'
|
|
|
|
.' {ftn : FTN to send link code to}'
|
|
|
|
.' {email : User to send the link to}';
|
|
|
|
|
|
|
|
protected $description = 'Send a link to a user';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Execute the console command.
|
|
|
|
*
|
2024-05-27 05:08:39 +00:00
|
|
|
* @return int
|
2022-12-04 02:30:38 +00:00
|
|
|
* @throws \Exception
|
|
|
|
*/
|
2024-05-27 05:08:39 +00:00
|
|
|
public function handle(): int
|
2022-12-04 02:30:38 +00:00
|
|
|
{
|
|
|
|
$ao = Address::findFTN($this->argument('ftn'));
|
2024-11-08 12:31:21 +00:00
|
|
|
$uo = User::where('email',$this->argument('email'))->sole();
|
2022-12-04 02:30:38 +00:00
|
|
|
|
2024-05-09 11:22:30 +00:00
|
|
|
Notification::route('netmail',$ao->uplink())->notify(new AddressLink($uo));
|
2024-05-27 05:08:39 +00:00
|
|
|
|
|
|
|
return self::SUCCESS;
|
2022-12-04 02:30:38 +00:00
|
|
|
}
|
|
|
|
}
|