Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
namespace Illuminate\Mail\Mailables;
4
 
5
use Illuminate\Support\Traits\Conditionable;
6
 
7
class Content
8
{
9
    use Conditionable;
10
 
11
    /**
12
     * The Blade view that should be rendered for the mailable.
13
     *
14
     * @var string|null
15
     */
16
    public $view;
17
 
18
    /**
19
     * The Blade view that should be rendered for the mailable.
20
     *
21
     * Alternative syntax for "view".
22
     *
23
     * @var string|null
24
     */
25
    public $html;
26
 
27
    /**
28
     * The Blade view that represents the text version of the message.
29
     *
30
     * @var string|null
31
     */
32
    public $text;
33
 
34
    /**
35
     * The Blade view that represents the Markdown version of the message.
36
     *
37
     * @var string|null
38
     */
39
    public $markdown;
40
 
41
    /**
42
     * The pre-rendered HTML of the message.
43
     *
44
     * @var string|null
45
     */
46
    public $htmlString;
47
 
48
    /**
49
     * The message's view data.
50
     *
51
     * @var array
52
     */
53
    public $with;
54
 
55
    /**
56
     * Create a new content definition.
57
     *
58
     * @param  string|null  $view
59
     * @param  string|null  $html
60
     * @param  string|null  $text
61
     * @param  string|null  $markdown
62
     * @param  array  $with
63
     * @param  string|null  $htmlString
64
     *
65
     * @named-arguments-supported
66
     */
67
    public function __construct(string $view = null, string $html = null, string $text = null, $markdown = null, array $with = [], string $htmlString = null)
68
    {
69
        $this->view = $view;
70
        $this->html = $html;
71
        $this->text = $text;
72
        $this->markdown = $markdown;
73
        $this->with = $with;
74
        $this->htmlString = $htmlString;
75
    }
76
 
77
    /**
78
     * Set the view for the message.
79
     *
80
     * @param  string  $view
81
     * @return $this
82
     */
83
    public function view(string $view)
84
    {
85
        $this->view = $view;
86
 
87
        return $this;
88
    }
89
 
90
    /**
91
     * Set the view for the message.
92
     *
93
     * @param  string  $view
94
     * @return $this
95
     */
96
    public function html(string $view)
97
    {
98
        return $this->view($view);
99
    }
100
 
101
    /**
102
     * Set the plain text view for the message.
103
     *
104
     * @param  string  $view
105
     * @return $this
106
     */
107
    public function text(string $view)
108
    {
109
        $this->text = $view;
110
 
111
        return $this;
112
    }
113
 
114
    /**
115
     * Set the Markdown view for the message.
116
     *
117
     * @param  string  $view
118
     * @return $this
119
     */
120
    public function markdown(string $view)
121
    {
122
        $this->markdown = $view;
123
 
124
        return $this;
125
    }
126
 
127
    /**
128
     * Set the pre-rendered HTML for the message.
129
     *
130
     * @param  string  $html
131
     * @return $this
132
     */
133
    public function htmlString(string $html)
134
    {
135
        $this->htmlString = $html;
136
 
137
        return $this;
138
    }
139
 
140
    /**
141
     * Add a piece of view data to the message.
142
     *
143
     * @param  string  $key
144
     * @param  mixed|null  $value
145
     * @return $this
146
     */
147
    public function with($key, $value = null)
148
    {
149
        if (is_array($key)) {
150
            $this->with = array_merge($this->with, $key);
151
        } else {
152
            $this->with[$key] = $value;
153
        }
154
 
155
        return $this;
156
    }
157
}