Temporarily fix invoice emailing
This commit is contained in:
@@ -35,15 +35,17 @@ class InvoiceEmail extends Command
|
||||
|
||||
$o = Invoice::findOrFail($this->argument('id'));
|
||||
|
||||
Mail::to($o->account->user->email)->send(new \App\Mail\InvoiceEmail($o));
|
||||
$result = Mail::to($o->account->user->email)->send(new \App\Mail\InvoiceEmail($o));
|
||||
|
||||
try {
|
||||
$o->print_status = TRUE;
|
||||
$o->reminders = $o->reminders('send');
|
||||
//$o->reminders = $o->reminders('send');
|
||||
$o->save();
|
||||
|
||||
} catch (\Exception $e) {
|
||||
dd($e);
|
||||
}
|
||||
|
||||
dump($result->getDebug());
|
||||
}
|
||||
}
|
@@ -1,46 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
|
||||
use App\Jobs\BroadbandTraffic;
|
||||
use App\Models\Supplier;
|
||||
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
/**
|
||||
* The Artisan commands provided by your application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $commands = [
|
||||
//
|
||||
];
|
||||
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
* @return void
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
// @todo This needs to be more generic and dynamic
|
||||
// Exetel Traffic
|
||||
$schedule->job(new BroadbandTraffic(Supplier::find(1)))->timezone('Australia/Melbourne')->dailyAt('10:00');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the commands for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function commands()
|
||||
{
|
||||
$this->load(__DIR__.'/Commands');
|
||||
|
||||
require base_path('routes/console.php');
|
||||
}
|
||||
}
|
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Clarkeash\Doorman\Exceptions\{ExpiredInviteCode,InvalidInviteCode,NotYourInviteCode};
|
||||
use Clarkeash\Doorman\Facades\Doorman;
|
||||
use Illuminate\View\View;
|
||||
use Barryvdh\Snappy\Facades\SnappyPdf as PDF;
|
||||
|
||||
@@ -33,10 +35,20 @@ class InvoiceController extends Controller
|
||||
* Render a specific invoice for the user
|
||||
*
|
||||
* @param Invoice $o
|
||||
* @param string|null $code
|
||||
* @return View
|
||||
*/
|
||||
public function view(Invoice $o): View
|
||||
public function view(Invoice $o,string $code=NULL): View
|
||||
{
|
||||
if ($code) {
|
||||
try {
|
||||
Doorman::redeem($code,$o->account->user->email);
|
||||
|
||||
} catch (ExpiredInviteCode|InvalidInviteCode|NotYourInviteCode $e) {
|
||||
abort(404);
|
||||
}
|
||||
}
|
||||
|
||||
return view('theme.backend.adminlte.invoice.view')
|
||||
->with('o',$o);
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use App\Models\Site;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
@@ -15,6 +16,7 @@ class InvoiceEmail extends Mailable
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public $invoice;
|
||||
public $site;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
@@ -33,10 +35,11 @@ class InvoiceEmail extends Mailable
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
Config::set('site',$this->invoice->site);
|
||||
Config::set('site',Site::findOrFail($this->invoice->site_id));
|
||||
$this->site = config('site');
|
||||
|
||||
return $this
|
||||
->markdown('email.user.invoice')
|
||||
->markdown('email.user.invoice',['site'=>config('site')])
|
||||
->subject(sprintf( 'Invoice: %s - Total: $%s - Due: %s',
|
||||
$this->invoice->id,
|
||||
number_format($this->invoice->total,2),
|
||||
|
@@ -132,7 +132,7 @@ class Product extends Model implements IDs
|
||||
return $this->hasOne(ProductTranslate::class)
|
||||
->where('language_id',(Auth::user() && Auth::user()->language_id)
|
||||
? Auth::user()->language_id
|
||||
: config('site')->language_id);
|
||||
: config('osb.language_id'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user