fix: pass `` to email
This commit is contained in:
parent
3899b99af4
commit
98dc469772
1 changed files with 17 additions and 6 deletions
|
@ -24,17 +24,24 @@ class Digest extends Mailable
|
||||||
/**
|
/**
|
||||||
* The current trip locations as a JSON object.
|
* The current trip locations as a JSON object.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var obj
|
||||||
*/
|
*/
|
||||||
public $locations;
|
public $locations;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current trip checkins as a JSON object.
|
* The current trip checkins as a JSON object.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var obj
|
||||||
*/
|
*/
|
||||||
public $checkinsList;
|
public $checkinsList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The current trip object.
|
||||||
|
*
|
||||||
|
* @var obj
|
||||||
|
*/
|
||||||
|
public $trip;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new message instance.
|
* Create a new message instance.
|
||||||
*
|
*
|
||||||
|
@ -45,7 +52,7 @@ class Digest extends Mailable
|
||||||
public function __construct(string $digest_type, string $trip_id)
|
public function __construct(string $digest_type, string $trip_id)
|
||||||
{
|
{
|
||||||
$this->digest_type = $digest_type;
|
$this->digest_type = $digest_type;
|
||||||
$trip = (new TrackerController)->get_trip_data($trip_id);
|
$this->trip = (new TrackerController)->get_trip_data($trip_id);
|
||||||
|
|
||||||
$cutoffDateTime = new DateTime();
|
$cutoffDateTime = new DateTime();
|
||||||
switch ($this->digest_type) {
|
switch ($this->digest_type) {
|
||||||
|
@ -65,7 +72,7 @@ class Digest extends Mailable
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->checkinsList = array_filter(
|
$this->checkinsList = array_filter(
|
||||||
$trip->checkins,
|
$this->trip->checkins,
|
||||||
function ($elem) use ($cutoffDateTime) {
|
function ($elem) use ($cutoffDateTime) {
|
||||||
$elemDateTime = new DateTime($elem->created_at);
|
$elemDateTime = new DateTime($elem->created_at);
|
||||||
return $elemDateTime > $cutoffDateTime;
|
return $elemDateTime > $cutoffDateTime;
|
||||||
|
@ -80,7 +87,11 @@ class Digest extends Mailable
|
||||||
*/
|
*/
|
||||||
public function build()
|
public function build()
|
||||||
{
|
{
|
||||||
return $this->view('emails.digest')
|
return $this->view(
|
||||||
->subject("track.bengoldsworthy.net ".ucwords($this->digest_type)." Digest");
|
'emails.digest',
|
||||||
|
[
|
||||||
|
'trip' => $this->trip
|
||||||
|
]
|
||||||
|
)->subject("track.bengoldsworthy.net ".ucwords($this->digest_type)." Digest");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue