Merge pull request #1749 from burakcakirel/request-in-document-created-event
Add request object to DocumentCreated event
This commit is contained in:
commit
a6f9c051e4
@ -77,7 +77,7 @@ class Invoices extends BulkAction
|
||||
foreach ($invoices as $invoice) {
|
||||
$clone = $invoice->duplicate();
|
||||
|
||||
event(new DocumentCreated($clone));
|
||||
event(new DocumentCreated($clone, $request));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ class RecurringCheck extends Command
|
||||
|
||||
switch ($type) {
|
||||
case 'App\Models\Document\Document':
|
||||
event(new DocumentCreated($clone));
|
||||
event(new DocumentCreated($clone, request()));
|
||||
|
||||
event(new DocumentRecurring($clone));
|
||||
|
||||
|
@ -33,7 +33,7 @@ class DuplicateDocument extends Job
|
||||
$this->clone = $this->document->duplicate();
|
||||
});
|
||||
|
||||
event(new DocumentCreated($this->clone));
|
||||
event(new DocumentCreated($this->clone, request()));
|
||||
|
||||
return $this->clone;
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ class SettingFieldCreated
|
||||
{
|
||||
$request = $event->request;
|
||||
|
||||
if ($request->has('setting')) {
|
||||
if (!$request->has('setting')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ class SettingFieldUpdated
|
||||
{
|
||||
$request = $event->request;
|
||||
|
||||
if ($request->has('setting')) {
|
||||
if (!$request->has('setting')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -268,7 +268,7 @@ class Document extends AbstractFactory
|
||||
$init_status = $document->status;
|
||||
|
||||
$document->status = 'draft';
|
||||
event(new DocumentCreated($document));
|
||||
event(new DocumentCreated($document, request()));
|
||||
$document->status = $init_status;
|
||||
|
||||
$amount = $this->faker->randomFloat(2, 1, 1000);
|
||||
|
@ -39,6 +39,17 @@ class InvoicesTest extends FeatureTestCase
|
||||
]);
|
||||
}
|
||||
|
||||
public function testItShouldDuplicateInvoice()
|
||||
{
|
||||
$invoice = $this->dispatch(new CreateDocument($this->getRequest()));
|
||||
|
||||
$this->loginAs()
|
||||
->get(route('invoices.duplicate', ['invoice' => $invoice->id]))
|
||||
->assertStatus(302);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
}
|
||||
|
||||
public function testItShouldCreateInvoiceWithRecurring()
|
||||
{
|
||||
$request = $this->getRequest(true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user