Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve hooking capabilities when sending documents
- Loading branch information
Hendrik Hagendorn
committed
Feb 26, 2023
1 parent
8a5eeea
commit d18c3b4
Showing
4 changed files
with
59 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace App\Events\Document; | ||
|
||
use App\Abstracts\Event; | ||
|
||
class DocumentSending extends Event | ||
{ | ||
public $document; | ||
|
||
/** | ||
* Create a new event instance. | ||
* | ||
* @param $document | ||
*/ | ||
public function __construct($document) | ||
{ | ||
$this->document = $document; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace App\Jobs\Document; | ||
|
||
use App\Abstracts\Job; | ||
use App\Events\Document\DocumentSending; | ||
use App\Events\Document\DocumentSent; | ||
use App\Models\Document\Document; | ||
|
||
class SendDocument extends Job | ||
{ | ||
public function __construct(Document $document) | ||
{ | ||
$this->document = $document; | ||
} | ||
|
||
public function handle(): void | ||
{ | ||
event(new DocumentSending($document)); | ||
|
||
// Notify the customer | ||
$invoice->contact->notify(new Notification($invoice, 'invoice_new_customer', true)); | ||
|
||
event(new DocumentSent($document)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters