mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 00:17:34 -05:00 
			
		
		
		
	
		
			
				
	
	
		
			23 lines
		
	
	
		
			446 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			446 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
namespace App\Listeners;
 | 
						|
 | 
						|
use App\Events\InvoiceWasDeleted;
 | 
						|
use App\Models\Task;
 | 
						|
 | 
						|
/**
 | 
						|
 * Class TaskListener.
 | 
						|
 */
 | 
						|
class TaskListener
 | 
						|
{
 | 
						|
    /**
 | 
						|
     * @param InvoiceWasDeleted $event
 | 
						|
     */
 | 
						|
    public function deletedInvoice(InvoiceWasDeleted $event)
 | 
						|
    {
 | 
						|
        // Release any tasks associated with the deleted invoice
 | 
						|
        Task::where('invoice_id', '=', $event->invoice->id)
 | 
						|
                ->update(['invoice_id' => null]);
 | 
						|
    }
 | 
						|
}
 |