Deprecate singleOrFail() in favour of sole()

This commit is contained in:
2024-11-08 23:31:21 +11:00
parent f0f2d74a14
commit 72ad1307c5
18 changed files with 27 additions and 43 deletions

View File

@@ -30,7 +30,7 @@ class AddressIdle extends Command
*/
public function handle(): int
{
$do = Domain::where('name',$this->argument('domain'))->singleOrFail();
$do = Domain::where('name',$this->argument('domain'))->sole();
return Job::dispatchSync($do,$this->option('ftn') ? Address::findFTN($this->option('ftn')) : NULL);
}

View File

@@ -27,8 +27,6 @@ class CommBinkpSend extends Command
*/
protected $description = 'BINKP send';
private const ID = 'BINKP';
/**
* Execute the console command.
*
@@ -42,7 +40,7 @@ class CommBinkpSend extends Command
Log::info(sprintf('CBS:- Call BINKP send for %s',$ao->ftn));
$mo = Mailer::where('name',self::ID)->singleOrFail();
$mo = Mailer::where('name','BINKP')->sole();
if ($this->option('now'))
Job::dispatchSync($ao,$mo);

View File

@@ -27,8 +27,6 @@ class CommEMSISend extends Command
*/
protected $description = 'EMSI send';
private const ID = 'EMSI';
/**
* Execute the console command.
*
@@ -42,7 +40,7 @@ class CommEMSISend extends Command
Log::info(sprintf('CES:- Call EMSI send for %s',$ao->ftn));
$mo = Mailer::where('name',self::ID)->singleOrFail();
$mo = Mailer::where('name','EMSI')->sole();
if ($this->option('now'))
Job::dispatchSync($ao,$mo);

View File

@@ -16,7 +16,7 @@ class ZoneCheck extends Command
public function handle(): int
{
$do = Domain::where('name',$this->argument('domain'))->singleOrFail();
$do = Domain::where('name',$this->argument('domain'))->sole();
foreach ($do->zones->sortby('zone_id') as $zo) {
if ($this->option('zone') && ($this->option('zone') != $zo->zone_id))

View File

@@ -34,7 +34,8 @@ class EchoareaImport extends Command
*/
public function handle(): int
{
$do = Domain::where('name',strtolower($this->argument('domain')))->singleOrFail();
$do = Domain::where('name',strtolower($this->argument('domain')))->single();
return Job::dispatchSync($this->argument('file'),$do,$this->option('prefix') ?: '',$this->option('unlink'));
}
}

View File

@@ -34,7 +34,8 @@ class FileareaImport extends Command
*/
public function handle(): int
{
$do = Domain::where('name',strtolower($this->argument('domain')))->singleOrFail();
$do = Domain::where('name',strtolower($this->argument('domain')))->sole();
return Job::dispatchSync($this->argument('file'),$do,$this->option('prefix') ?: '',$this->option('unlink'));
}
}

View File

@@ -40,7 +40,7 @@ class Rescan extends Command
if (! $this->argument('area'))
throw new \Exception('Areaname is required');
$fao = Filearea::where('name',$this->argument('area'))->singleOrFail();
$fao = Filearea::where('name',$this->argument('area'))->sole();
if ($fao->domain_id !== $ao->zone->domain_id)
throw new \Exception(sprintf('File area [%s] is not in domain [%s] for FTN [%s]',$fao->name,$ao->zone->domain->name,$ao->ftn));

View File

@@ -33,7 +33,7 @@ class NodesNew extends Command
*/
public function handle(): int
{
$do = Domain::where('name',$this->argument('domain'))->singleOrFail();
$do = Domain::where('name',$this->argument('domain'))->sole();
$ao = NULL;
if ($this->option('netmail')) {

View File

@@ -25,7 +25,7 @@ class UserCodeSend extends Command
public function handle(): int
{
$ao = Address::findFTN($this->argument('ftn'));
$uo = User::where('email',$this->argument('email'))->singleOrFail();
$uo = User::where('email',$this->argument('email'))->sole();
Notification::route('netmail',$ao->uplink())->notify(new AddressLink($uo));