diff --git a/app/Email.php b/app/Email.php index 20613a05..1ac79593 100644 --- a/app/Email.php +++ b/app/Email.php @@ -17,7 +17,7 @@ class Email extends Model const CANCELLED = 8; const FAILED = 9; - protected $fillable = ['sender_name', 'sender_email', 'receiver_name', 'receiver_email', 'subject', 'message', 'tls', 'has_attachment', 'attachment', 'status']; + protected $fillable = ['sender_name', 'sender_email', 'receiver_name', 'receiver_email', 'subject', 'message', 'tls', 'has_attachment', 'attachment', 'status', 'uuid']; protected $touches = ['campaign']; diff --git a/app/EmailTemplate.php b/app/EmailTemplate.php index 558f4ee7..9e5deafd 100644 --- a/app/EmailTemplate.php +++ b/app/EmailTemplate.php @@ -55,6 +55,7 @@ public function craft_email($campaign, $targetUser) $email->tls = true; // Maybe change this to be editable in the campaign $email->has_attachment = false; // Maybe change this to be editable in the campaign $email->status = Email::NOT_SENT; + $email->uuid = $targetUser->uuid($campaign); $email->save(); return $email; } diff --git a/database/migrations/2017_01_10_034451_add_uuid_to_email.php b/database/migrations/2017_01_10_034451_add_uuid_to_email.php new file mode 100644 index 00000000..c781a169 --- /dev/null +++ b/database/migrations/2017_01_10_034451_add_uuid_to_email.php @@ -0,0 +1,31 @@ +string('uuid')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('emails', function (Blueprint $table) { + $table->dropColumn('uuid'); + }); + } +}