Skip to content

Commit 6458dbe

Browse files
committed
wip
1 parent 5971218 commit 6458dbe

22 files changed

+356
-1619
lines changed

src/Attachment.php

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Stackkit\LaravelDatabaseEmails;
6+
7+
use RuntimeException;
8+
9+
class Attachment
10+
{
11+
public ?string $as = null;
12+
13+
public ?string $mime = null;
14+
15+
public function __construct(public string $path, public ?string $disk = null)
16+
{
17+
//
18+
}
19+
20+
public static function fromPath($path)
21+
{
22+
return new static($path);
23+
}
24+
25+
public static function fromData()
26+
{
27+
throw new RuntimeException('Raw attachments are not supported in the database email driver.');
28+
}
29+
30+
public static function fromStorage()
31+
{
32+
throw new RuntimeException('Raw attachments are not supported in the database email driver.');
33+
}
34+
35+
public static function fromStorageDisk($disk, $path)
36+
{
37+
return new static($path, $disk);
38+
}
39+
40+
public function as(string $name)
41+
{
42+
$this->as = $name;
43+
44+
return $this;
45+
}
46+
47+
public function withMime(string $mime)
48+
{
49+
$this->mime = $mime;
50+
51+
return $this;
52+
}
53+
54+
public function toArray(): array
55+
{
56+
return [
57+
'path' => $this->path,
58+
'disk' => $this->disk,
59+
'as' => $this->as,
60+
'mime' => $this->mime,
61+
];
62+
}
63+
}

src/Config.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,6 @@ public static function maxAttemptCount(): int
1414
return max(config('laravel-database-emails.attempts', 1), 3);
1515
}
1616

17-
/**
18-
* Determine if newly created e-mails should be encrypted.
19-
*/
20-
public static function encryptEmails(): bool
21-
{
22-
return config('laravel-database-emails.encrypt', false);
23-
}
24-
2517
/**
2618
* Determine if newly created e-mails should be sent to the test e-mail address.
2719
*/

0 commit comments

Comments
 (0)