Changeset View
Changeset View
Standalone View
Standalone View
src/app/Console/Commands/AuthAttemptDelete.php
- This file was added.
<?php | |||||
namespace App\Console\Commands; | |||||
machniak: I would suggest app/Commands/AuthAttempt/DeleteCommand.php. | |||||
use App\Console\Command; | |||||
use App\AuthAttempt; | |||||
class AuthAttemptDelete extends Command | |||||
{ | |||||
/** | |||||
* The name and signature of the console command. | |||||
* | |||||
* @var string | |||||
*/ | |||||
protected $signature = 'authattempt:delete {id}'; | |||||
/** | |||||
* The console command description. | |||||
* | |||||
* @var string | |||||
*/ | |||||
protected $description = 'Delete an AuthAttempt'; | |||||
/** | |||||
* Execute the console command. | |||||
* | |||||
* @return mixed | |||||
*/ | |||||
public function handle() | |||||
{ | |||||
$authAttempt = AuthAttempt::findOrFail($this->argument('id')); | |||||
if ($authAttempt == null) { | |||||
machniakUnsubmitted Done Inline ActionsWith findOrFail() the if does not make sense. There will be an exception thrown if the record wasn't found. machniak: With findOrFail() the if does not make sense. There will be an exception thrown if the record… | |||||
return 1; | |||||
} | |||||
$authAttempt->delete(); | |||||
} | |||||
} |
I would suggest app/Commands/AuthAttempt/DeleteCommand.php.