Email template work

This commit is contained in:
Deon George
2020-01-21 20:59:10 +11:00
parent 1767f5ac41
commit e62603a1b3
18 changed files with 799 additions and 792 deletions

View File

@@ -0,0 +1,49 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Mail;
use App\Mail\TestEmail as MailTest;
use App\User;
class TestEmail extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'test:email {id}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Send a test email';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$uo = User::find($this->argument('id'));
Mail::to($uo->email)
->send(new MailTest($uo));
}
}

View File

@@ -49,4 +49,4 @@ class LoginController extends Controller
return view('adminlte::auth.login')->with('login_note',$login_note);
}
}
}

View File

@@ -25,7 +25,7 @@ class SocialLink extends Mailable
public function __construct(AccountOauth $o)
{
$this->token = $o->link_token;
$this->user = $o;
$this->user = $o->account->user;
}
/**
@@ -38,6 +38,8 @@ class SocialLink extends Mailable
return $this
->markdown('email.system.social_link')
->subject('Link your Account')
->with(['site'=>$this->user->site]);
->with([
'site'=>$this->user->site,
]);
}
}

41
app/Mail/TestEmail.php Normal file
View File

@@ -0,0 +1,41 @@
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use App\User;
class TestEmail extends Mailable
{
use Queueable, SerializesModels;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct(User $o)
{
$this->user = $o;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this
->markdown('email.system.test_email')
->subject('Just a test...')
->with([
'site'=>$this->user->site,
'user'=>$this->user,
]);
}
}

View File

@@ -76,6 +76,15 @@ class Site extends Model
return Arr::get($default,$key);
}
public function getEmailLogoAttribute()
{
//$return = $this->getSiteDetailValue('email_logo')->value;
// @todo Get from the DB.
$return = 'site/1/gthpl-white.png';
return $return ? 'storage/'.$return : '/image/generic/150/20/fff';
}
public function getSiteLogoAttribute()
{
$return = $this->getSiteDetailValue('site_logo')->value;