|
@@ -11,7 +11,6 @@ use Illuminate\Http\Request;
|
|
|
use Illuminate\Support\Facades\Log;
|
|
use Illuminate\Support\Facades\Log;
|
|
|
use Illuminate\Support\Facades\Storage;
|
|
use Illuminate\Support\Facades\Storage;
|
|
|
use Illuminate\Support\Str;
|
|
use Illuminate\Support\Str;
|
|
|
-use function PHPUnit\Framework\isString;
|
|
|
|
|
|
|
|
|
|
class ProductController extends Controller
|
|
class ProductController extends Controller
|
|
|
{
|
|
{
|
|
@@ -112,12 +111,12 @@ class ProductController extends Controller
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if(Str::endsWith($filterName, '_from')) {
|
|
if(Str::endsWith($filterName, '_from')) {
|
|
|
- if(isString($filterValue) && DateHelper::isDate($filterValue)) {
|
|
|
|
|
|
|
+ if(is_string($filterValue) && DateHelper::isDate($filterValue)) {
|
|
|
$filterValue .= ' 00:00:00';
|
|
$filterValue .= ' 00:00:00';
|
|
|
}
|
|
}
|
|
|
$q->where(Str::replace('_from', '', $filterName), '>=', $filterValue);
|
|
$q->where(Str::replace('_from', '', $filterName), '>=', $filterValue);
|
|
|
} elseif(Str::endsWith($filterName, '_to')) {
|
|
} elseif(Str::endsWith($filterName, '_to')) {
|
|
|
- if(isString($filterValue) && DateHelper::isDate($filterValue)) {
|
|
|
|
|
|
|
+ if(is_string($filterValue) && DateHelper::isDate($filterValue)) {
|
|
|
$filterValue .= ' 23:59:59';
|
|
$filterValue .= ' 23:59:59';
|
|
|
}
|
|
}
|
|
|
$q->where(Str::replace('_to', '', $filterName), '<=', $filterValue);
|
|
$q->where(Str::replace('_to', '', $filterName), '<=', $filterValue);
|
|
@@ -188,13 +187,15 @@ class ProductController extends Controller
|
|
|
public function export(Request $request)
|
|
public function export(Request $request)
|
|
|
{
|
|
{
|
|
|
$request->validate([
|
|
$request->validate([
|
|
|
- 'withFilter' => 'nullable',
|
|
|
|
|
|
|
+ 'withFilter' => 'nullable',
|
|
|
|
|
+ 'filters' => 'nullable|array',
|
|
|
]);
|
|
]);
|
|
|
|
|
|
|
|
// load and save file
|
|
// load and save file
|
|
|
|
|
+ $filters = ($request->withFilter) ? $request->filters : [];
|
|
|
|
|
|
|
|
// dispatch job
|
|
// dispatch job
|
|
|
- ExportCatalog::dispatch([], $request->user()->id);
|
|
|
|
|
|
|
+ ExportCatalog::dispatch($filters, $request->user()->id);
|
|
|
Log::info('ImportCatalog job created!');
|
|
Log::info('ImportCatalog job created!');
|
|
|
|
|
|
|
|
|
|
|