clrghouz/app/Console/Commands/UserCodeSend.php
Deon George e15331ec35
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 40s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m43s
Create Docker Image / Final Docker Image Manifest (push) Successful in 10s
No function changes. Cleanup console command cleanup
2024-05-27 15:08:39 +10:00

34 lines
755 B
PHP

<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Notification;
use App\Models\{Address,User};
use App\Notifications\Netmails\AddressLink;
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.
*
* @return int
* @throws \Exception
*/
public function handle(): int
{
$ao = Address::findFTN($this->argument('ftn'));
$uo = User::where('email',$this->argument('email'))->singleOrFail();
Notification::route('netmail',$ao->uplink())->notify(new AddressLink($uo));
return self::SUCCESS;
}
}