Skip to content

Instantly share code, notes, and snippets.

@jongravois
Created January 4, 2021 18:03
Show Gist options
  • Save jongravois/9e3e0d9c27ee60f5c6fb3763a5e729e7 to your computer and use it in GitHub Desktop.
Save jongravois/9e3e0d9c27ee60f5c6fb3763a5e729e7 to your computer and use it in GitHub Desktop.
<?php namespace App\Pipes\Invoices;
use App\Models\PostedInvoice;
use Closure;
class NoConsignmentAbort
{
public function handle(PostedInvoice $invoice, Closure $next)
{
if(!$invoice->consignment_code) {
//TODO NOTIFY
$invoice->update([
'gp_percent_used' => 0,
'profit' => 0,
'split_bands' => false,
'processed' => true
]);
} // end if
return $next($invoice);
} // end function
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment