Skip to content

Instantly share code, notes, and snippets.

@jongravois
Created January 4, 2021 18:03
Show Gist options
  • Save jongravois/7f6f9ad663eff3519103dda48bb2b9e3 to your computer and use it in GitHub Desktop.
Save jongravois/7f6f9ad663eff3519103dda48bb2b9e3 to your computer and use it in GitHub Desktop.
<?php
namespace App\Jobs;
use App\Models\ConsignmentBand;
use App\Models\PostedInvoice;
use App\Models\Project;
use App\Pipes\Invoices\BandedRatesProfit;
use App\Pipes\Invoices\FixedRateProfit;
use App\Pipes\Invoices\NoConsignmentAbort;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Pipeline\Pipeline;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class ProcessInvoiceJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public $invoice;
public function __construct(PostedInvoice $invoice)
{
$this->invoice = $invoice;
}
public function handle()
{
app(Pipeline::class)
->send($this->invoice)
->through([
NoConsignmentAbort::class,
FixedRateProfit::class,
BandedRatesProfit::class
])
->thenReturn();
} // end function
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment