Skip to content

Commit 4c277bc

Browse files
committed
Change route names to be less colliding.
1 parent 531a6c3 commit 4c277bc

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

routes/api.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
|
1414
*/
1515

16-
// TODO: Add prefix to route name
17-
Route::resource('mail', \Jstoone\Mailman\Http\Controllers\MailmanController::class)
18-
->only(['index', 'show']);
16+
Route::apiResource('mail', \Jstoone\Mailman\Http\Controllers\MailmanController::class)
17+
->only(['index', 'show'])
18+
->names([
19+
'index' => 'nova-mailman.index',
20+
'show' => 'nova-mailman.show',
21+
]);

src/Mailer/MailmanTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ protected function getMailMetadata(Swift_Mime_SimpleMessage $message): string
103103
'recipient' => array_first(array_keys($message->getTo())),
104104
'subject' => $message->getSubject(),
105105
'sent_at' => time(),
106-
'link' => route('mail.show', $this->identifier),
106+
'link' => route('nova-mailman.show', $this->identifier),
107107
], JSON_PRETTY_PRINT);
108108
}
109109
}

tests/Http/Controllers/MailmanControllerTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,23 @@ public function it_returns_emails()
2020
);
2121

2222
$this->withoutExceptionHandling();
23-
$response = $this->get(route('mail.index'))
23+
$response = $this->get(route('nova-mailman.index'))
2424
->assertSuccessful()
2525
->assertJson([
2626
[
2727
'id' => 'unique-mail-identifier',
2828
'recipient' => $recipient,
2929
'subject' => $subject,
3030
'sent_at' => time(),
31-
'link' => route('mail.show', 'unique-mail-identifier'),
31+
'link' => route('nova-mailman.show', 'unique-mail-identifier'),
3232
],
3333
]);
3434
}
3535

3636
/** @test */
3737
public function it_gives_empty_response_upon_missing_directory()
3838
{
39-
$this->get(route('mail.index'))
39+
$this->get(route('nova-mailman.index'))
4040
->assertSuccessful()
4141
->assertJson([]);
4242
}
@@ -54,7 +54,7 @@ public function it_can_return_the_view_for_a_given_mail()
5454
$recipient = '[email protected]'
5555
);
5656

57-
$this->get(route('mail.show', 'unique-mail-identifier'))
57+
$this->get(route('nova-mailman.show', 'unique-mail-identifier'))
5858
->assertSuccessful()
5959
->assertViewIs('nova-mailman-mails::unique-mail-identifier');
6060
}

tests/Mailer/MailmanTransportTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function it_stores_email_metadata_in_a_json_file()
5656
'subject' => $message->getSubject(),
5757
'recipient' => '[email protected]',
5858
'sent_at' => time(),
59-
'link' => route('mail.show', 'unique-identifier'),
59+
'link' => route('nova-mailman.show', 'unique-identifier'),
6060
],
6161
json_decode($file, true)
6262
);

0 commit comments

Comments
 (0)