Skip to content

Commit

Permalink
Merge pull request #70 from RonasIT/refactoring-mail-classes
Browse files Browse the repository at this point in the history
refactor: update mails format
  • Loading branch information
DenTray committed May 20, 2024
2 parents 2022b8a + e578c3b commit d3c69a3
Show file tree
Hide file tree
Showing 13 changed files with 547 additions and 546 deletions.
27 changes: 27 additions & 0 deletions app/Mail/BaseMail.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;

abstract class BaseMail extends Mailable implements ShouldQueue
{
use Queueable;
use SerializesModels;

public int $tries = 5;

public function __construct(public $viewData)
{
$this->queue = 'mails';
}

abstract public function envelope(): Envelope;

abstract public function content(): Content;
}
24 changes: 24 additions & 0 deletions app/Mail/ForgotPasswordMail.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace App\Mail;

use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;

class ForgotPasswordMail extends BaseMail
{
public function envelope(): Envelope
{
return new Envelope(
subject: __('Forgot password?'),
);
}

public function content(): Content
{
return new Content(
view: 'emails.forgot_password',
with: $this->viewData,
);
}
}
43 changes: 0 additions & 43 deletions app/Mails/BaseMail.php

This file was deleted.

15 changes: 0 additions & 15 deletions app/Mails/ForgotPasswordMail.php

This file was deleted.

2 changes: 1 addition & 1 deletion app/Services/UserService.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Services;

use App\Mails\ForgotPasswordMail;
use App\Mail\ForgotPasswordMail;
use App\Models\Role;
use App\Repositories\UserRepository;
use Carbon\Carbon;
Expand Down
7 changes: 3 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"type": "project",
"require": {
"php": "^8.1",
"ext-openssl": "*",
"doctrine/dbal": "^3.8",
"laravel/framework": "^10.48",
"laravel/legacy-factories": "^1.4",
Expand All @@ -19,14 +20,13 @@
"nunomaduro/collision": "^6.4",
"php-open-source-saver/jwt-auth": "^2.2",
"psr/simple-cache": "^3.0",
"ronasit/laravel-helpers": "^2.5",
"ronasit/laravel-helpers": "dev-master",
"ronasit/laravel-swagger": "^2.2",
"spatie/laravel-google-cloud-storage": "^2.3",
"spatie/laravel-ignition": "^2.4",
"symfony/http-client": "6.4.5",
"symfony/mailgun-mailer": "6.4.4",
"symfony/postmark-mailer": "6.4.4",
"ext-openssl": "*"
"symfony/postmark-mailer": "6.4.4"
},
"require-dev": {
"ext-json": "*",
Expand All @@ -36,7 +36,6 @@
"friendsofphp/php-cs-fixer": "^3.8",
"mockery/mockery": "^1.6",
"php-coveralls/php-coveralls": "^2.7",
"php-mock/php-mock-phpunit": "^2.10",
"phpunit/phpunit": "^9.6.17",
"ronasit/laravel-entity-generator": ">=2.0.4-beta",
"tightenco/tlint": "^9.3"
Expand Down
Loading

0 comments on commit d3c69a3

Please sign in to comment.