Skip to content

Commit 8c1d19a

Browse files
committed
Remove email:retry
1 parent 2b5c5d5 commit 8c1d19a

File tree

3 files changed

+56
-16
lines changed

3 files changed

+56
-16
lines changed

src/LaravelDatabaseEmailsServiceProvider.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ public function register()
3333
{
3434
$this->commands([
3535
SendEmailsCommand::class,
36-
RetryFailedEmailsCommand::class,
3736
ResendEmailsCommand::class,
3837
]);
3938
}

src/ResendEmailsCommand.php

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
namespace Buildcode\LaravelDatabaseEmails;
44

5-
class ResendEmailsCommand extends RetryFailedEmailsCommand
5+
use Illuminate\Console\Command;
6+
7+
class ResendEmailsCommand extends Command
68
{
79
/**
810
* The name and signature of the console command.
@@ -17,4 +19,57 @@ class ResendEmailsCommand extends RetryFailedEmailsCommand
1719
* @var string
1820
*/
1921
protected $description = 'Resend failed e-mails';
22+
23+
/**
24+
* The e-mail repository.
25+
*
26+
* @var Store
27+
*/
28+
protected $store;
29+
30+
/**
31+
* Create a new SendEmailsCommand instance.
32+
*
33+
* @param Store $store
34+
*/
35+
public function __construct(Store $store)
36+
{
37+
parent::__construct();
38+
39+
$this->store = $store;
40+
}
41+
42+
/**
43+
* Execute the console command.
44+
*
45+
* @return void
46+
*/
47+
public function handle()
48+
{
49+
$emails = $this->store->getFailed(
50+
$this->argument('id')
51+
);
52+
53+
if ($emails->isEmpty()) {
54+
$this->line('There is nothing to reset.');
55+
56+
return;
57+
}
58+
59+
foreach ($emails as $email) {
60+
$email->retry();
61+
}
62+
63+
$this->info('Reset ' . $emails->count() . ' ' . ngettext('e-mail', 'e-mails', $emails->count()) . '!');
64+
}
65+
66+
/**
67+
* Execute the console command (backwards compatibility for Laravel 5.4 and below).
68+
*
69+
* @return void
70+
*/
71+
public function fire()
72+
{
73+
$this->handle();
74+
}
2075
}

tests/RetryFailedEmailsCommandTest.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,4 @@ public function a_single_email_can_be_resent()
5050

5151
$this->assertEquals(3, DB::table('emails')->count());
5252
}
53-
54-
/** @test */
55-
public function email_retry_is_deprecated()
56-
{
57-
$deprecated = 'This command is deprecated';
58-
59-
$this->artisan('email:retry');
60-
61-
$this->assertContains($deprecated, Artisan::output());
62-
63-
$this->artisan('email:resend');
64-
65-
$this->assertNotContains($deprecated, Artisan::output());
66-
}
6753
}

0 commit comments

Comments
 (0)