Merge pull request #2159 from cuneytsenturk/master
MultipleSheets import validation message (#mx7kmv)
This commit is contained in:
commit
ba03cb409a
25
app/Abstracts/ImportMultipleSheets.php
Normal file
25
app/Abstracts/ImportMultipleSheets.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Abstracts;
|
||||
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Maatwebsite\Excel\Concerns\Importable;
|
||||
use Maatwebsite\Excel\Concerns\WithChunkReading;
|
||||
use Maatwebsite\Excel\Concerns\WithMultipleSheets;
|
||||
|
||||
abstract class ImportMultipleSheets implements ShouldQueue, WithChunkReading, WithMultipleSheets
|
||||
{
|
||||
use Importable;
|
||||
|
||||
public $user;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->user = user();
|
||||
}
|
||||
|
||||
public function chunkSize(): int
|
||||
{
|
||||
return 100;
|
||||
}
|
||||
}
|
@ -2,17 +2,12 @@
|
||||
|
||||
namespace App\Imports\Common;
|
||||
|
||||
use App\Abstracts\ImportMultipleSheets;
|
||||
use App\Imports\Common\Sheets\Items as Base;
|
||||
use App\Imports\Common\Sheets\ItemTaxes;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Maatwebsite\Excel\Concerns\Importable;
|
||||
use Maatwebsite\Excel\Concerns\WithChunkReading;
|
||||
use Maatwebsite\Excel\Concerns\WithMultipleSheets;
|
||||
|
||||
class Items implements ShouldQueue, WithChunkReading, WithMultipleSheets
|
||||
class Items extends ImportMultipleSheets
|
||||
{
|
||||
use Importable;
|
||||
|
||||
public function sheets(): array
|
||||
{
|
||||
return [
|
||||
@ -20,9 +15,4 @@ class Items implements ShouldQueue, WithChunkReading, WithMultipleSheets
|
||||
'item_taxes' => new ItemTaxes(),
|
||||
];
|
||||
}
|
||||
|
||||
public function chunkSize(): int
|
||||
{
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
|
@ -2,21 +2,16 @@
|
||||
|
||||
namespace App\Imports\Purchases;
|
||||
|
||||
use App\Abstracts\ImportMultipleSheets;
|
||||
use App\Imports\Purchases\Sheets\Bills as Base;
|
||||
use App\Imports\Purchases\Sheets\BillItems;
|
||||
use App\Imports\Purchases\Sheets\BillItemTaxes;
|
||||
use App\Imports\Purchases\Sheets\BillHistories;
|
||||
use App\Imports\Purchases\Sheets\BillTotals;
|
||||
use App\Imports\Purchases\Sheets\BillTransactions;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Maatwebsite\Excel\Concerns\Importable;
|
||||
use Maatwebsite\Excel\Concerns\WithChunkReading;
|
||||
use Maatwebsite\Excel\Concerns\WithMultipleSheets;
|
||||
|
||||
class Bills implements ShouldQueue, WithChunkReading, WithMultipleSheets
|
||||
class Bills extends ImportMultipleSheets
|
||||
{
|
||||
use Importable;
|
||||
|
||||
public function sheets(): array
|
||||
{
|
||||
return [
|
||||
@ -28,9 +23,4 @@ class Bills implements ShouldQueue, WithChunkReading, WithMultipleSheets
|
||||
'bill_transactions' => new BillTransactions(),
|
||||
];
|
||||
}
|
||||
|
||||
public function chunkSize(): int
|
||||
{
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
|
@ -2,21 +2,16 @@
|
||||
|
||||
namespace App\Imports\Sales;
|
||||
|
||||
use App\Abstracts\ImportMultipleSheets;
|
||||
use App\Imports\Sales\Sheets\Invoices as Base;
|
||||
use App\Imports\Sales\Sheets\InvoiceItems;
|
||||
use App\Imports\Sales\Sheets\InvoiceItemTaxes;
|
||||
use App\Imports\Sales\Sheets\InvoiceHistories;
|
||||
use App\Imports\Sales\Sheets\InvoiceTotals;
|
||||
use App\Imports\Sales\Sheets\InvoiceTransactions;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Maatwebsite\Excel\Concerns\Importable;
|
||||
use Maatwebsite\Excel\Concerns\WithChunkReading;
|
||||
use Maatwebsite\Excel\Concerns\WithMultipleSheets;
|
||||
|
||||
class Invoices implements ShouldQueue, WithChunkReading, WithMultipleSheets
|
||||
class Invoices extends ImportMultipleSheets
|
||||
{
|
||||
use Importable;
|
||||
|
||||
public function sheets(): array
|
||||
{
|
||||
return [
|
||||
@ -28,9 +23,4 @@ class Invoices implements ShouldQueue, WithChunkReading, WithMultipleSheets
|
||||
'invoice_transactions' => new InvoiceTransactions(),
|
||||
];
|
||||
}
|
||||
|
||||
public function chunkSize(): int
|
||||
{
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ class Queue extends Provider
|
||||
// Get import class
|
||||
$class = $ref->getValue($excel_job);
|
||||
|
||||
if (!$class instanceof \App\Abstracts\Import) {
|
||||
if (!$class instanceof \App\Abstracts\Import && !$class instanceof \App\Abstracts\ImportMultipleSheets) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user