public function __construct()
 {
     $templates = Touch::all()->each(function ($touch) {
         $client = $touch->campaign->client->name;
         $campaign = $touch->campaign->name;
         $title = $touch->title;
         $touch->myValue = "{$client} | {$campaign} | {$title}";
     })->lists('myValue', 'id')->sort();
     $contactFields = array_keys(Contact::all()->first()->toArray());
     view()->share(['templates' => $templates, 'contactFields' => $contactFields]);
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::table('touches', function ($table) {
         $table->text('template_html');
         $table->text('template_text');
         $table->text('preview_text');
     });
     $touches = Touch::all();
     $touches->each(function ($touch) {
         $html = view("emails.{$touch->template}")->with(['salted_id' => null, 'campaign' => $touch->campaign, 'email' => false]);
         $text = view("text_emails.{$touch->template}")->with('campaign', $touch->campaign);
         $touch->template_html = $html;
         $touch->template_text = $text;
         $touch->save();
     });
 }