this makes possible adding extra attributes to models
This commit is contained in:
		@@ -3,14 +3,19 @@
 | 
			
		||||
namespace App\Imports\Sales;
 | 
			
		||||
 | 
			
		||||
use App\Abstracts\Import;
 | 
			
		||||
use App\Models\Common\Contact as Model;
 | 
			
		||||
use App\Events\Common\ModelCreated;
 | 
			
		||||
use App\Http\Requests\Common\Contact as Request;
 | 
			
		||||
use App\Models\Common\Contact as Model;
 | 
			
		||||
 | 
			
		||||
class Customers extends Import
 | 
			
		||||
{
 | 
			
		||||
    public function model(array $row)
 | 
			
		||||
    {
 | 
			
		||||
        return new Model($row);
 | 
			
		||||
        $model = new Model($row);
 | 
			
		||||
 | 
			
		||||
        event(new ModelCreated($model, $row));
 | 
			
		||||
 | 
			
		||||
        return $model;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function map($row): array
 | 
			
		||||
 
 | 
			
		||||
@@ -3,6 +3,7 @@
 | 
			
		||||
namespace App\Imports\Sales;
 | 
			
		||||
 | 
			
		||||
use App\Abstracts\Import;
 | 
			
		||||
use App\Events\Common\ModelCreated;
 | 
			
		||||
use App\Http\Requests\Banking\Transaction as Request;
 | 
			
		||||
use App\Models\Banking\Transaction as Model;
 | 
			
		||||
 | 
			
		||||
@@ -10,7 +11,11 @@ class Revenues extends Import
 | 
			
		||||
{
 | 
			
		||||
    public function model(array $row)
 | 
			
		||||
    {
 | 
			
		||||
        return new Model($row);
 | 
			
		||||
        $model = new Model($row);
 | 
			
		||||
 | 
			
		||||
        event(new ModelCreated($model, $row));
 | 
			
		||||
 | 
			
		||||
        return $model;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function map($row): array
 | 
			
		||||
 
 | 
			
		||||
@@ -3,6 +3,7 @@
 | 
			
		||||
namespace App\Imports\Sales\Sheets;
 | 
			
		||||
 | 
			
		||||
use App\Abstracts\Import;
 | 
			
		||||
use App\Events\Common\ModelCreated;
 | 
			
		||||
use App\Http\Requests\Document\DocumentItem as Request;
 | 
			
		||||
use App\Models\Document\Document;
 | 
			
		||||
use App\Models\Document\DocumentItem as Model;
 | 
			
		||||
@@ -11,7 +12,11 @@ class InvoiceItems extends Import
 | 
			
		||||
{
 | 
			
		||||
    public function model(array $row)
 | 
			
		||||
    {
 | 
			
		||||
        return new Model($row);
 | 
			
		||||
        $model = new Model($row);
 | 
			
		||||
 | 
			
		||||
        event(new ModelCreated($model, $row));
 | 
			
		||||
 | 
			
		||||
        return $model;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function map($row): array
 | 
			
		||||
 
 | 
			
		||||
@@ -3,6 +3,7 @@
 | 
			
		||||
namespace App\Imports\Sales\Sheets;
 | 
			
		||||
 | 
			
		||||
use App\Abstracts\Import;
 | 
			
		||||
use App\Events\Common\ModelCreated;
 | 
			
		||||
use App\Http\Requests\Document\Document as Request;
 | 
			
		||||
use App\Models\Document\Document as Model;
 | 
			
		||||
use Illuminate\Support\Str;
 | 
			
		||||
@@ -11,7 +12,11 @@ class Invoices extends Import
 | 
			
		||||
{
 | 
			
		||||
    public function model(array $row)
 | 
			
		||||
    {
 | 
			
		||||
        return new Model($row);
 | 
			
		||||
        $model = new Model($row);
 | 
			
		||||
 | 
			
		||||
        event(new ModelCreated($model, $row));
 | 
			
		||||
 | 
			
		||||
        return $model;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function map($row): array
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user