Missing job added & Code refactoring
This commit is contained in:
parent
c8a5cc1cb1
commit
6239ad7f31
@ -11,11 +11,8 @@ use App\Jobs\Common\CreateContact;
|
||||
use App\Jobs\Common\DeleteContact;
|
||||
use App\Jobs\Common\DuplicateContact;
|
||||
use App\Jobs\Common\UpdateContact;
|
||||
use App\Models\Banking\Transaction;
|
||||
use App\Models\Common\Contact;
|
||||
use App\Models\Document\Document;
|
||||
use App\Traits\Contacts;
|
||||
use App\Utilities\Date;
|
||||
|
||||
class Vendors extends Controller
|
||||
{
|
||||
|
@ -11,11 +11,8 @@ use App\Jobs\Common\CreateContact;
|
||||
use App\Jobs\Common\DeleteContact;
|
||||
use App\Jobs\Common\DuplicateContact;
|
||||
use App\Jobs\Common\UpdateContact;
|
||||
use App\Models\Banking\Transaction;
|
||||
use App\Models\Common\Contact;
|
||||
use App\Models\Document\Document;
|
||||
use App\Traits\Contacts;
|
||||
use App\Utilities\Date;
|
||||
|
||||
class Customers extends Controller
|
||||
{
|
||||
|
27
app/Jobs/Common/DuplicateContact.php
Normal file
27
app/Jobs/Common/DuplicateContact.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs\Common;
|
||||
|
||||
use App\Abstracts\Job;
|
||||
use App\Models\Common\Contact;
|
||||
|
||||
class DuplicateContact extends Job
|
||||
{
|
||||
protected $clone;
|
||||
|
||||
public function __construct(Contact $model)
|
||||
{
|
||||
$this->model = $model;
|
||||
|
||||
parent::__construct($model);
|
||||
}
|
||||
|
||||
public function handle(): Contact
|
||||
{
|
||||
\DB::transaction(function () {
|
||||
$this->clone = $this->model->duplicate();
|
||||
});
|
||||
|
||||
return $this->clone;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user