Uploading content
This commit is contained in:
25
app/Tables/TableWithExport.php
Normal file
25
app/Tables/TableWithExport.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Tables;
|
||||
|
||||
use App\Models\Product;
|
||||
use App\Tables\Traits\WithExportableProductColumns;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Http\Response;
|
||||
use Mmt\GenericTable\Components\ColumnCollection;
|
||||
use Mmt\GenericTable\Interfaces\IExportable;
|
||||
use Mmt\GenericTable\Interfaces\IGenericTable;
|
||||
use Mmt\GenericTable\Support\ExportEventArgs;
|
||||
use Mmt\GenericTable\Support\ExportSettings;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
|
||||
class TableWithExport implements IGenericTable, IExportable
|
||||
{
|
||||
use WithExportableProductColumns;
|
||||
|
||||
public function onExport(ExportEventArgs $args) : BinaryFileResponse|Response
|
||||
{
|
||||
$args->settings->fileName = 'products';
|
||||
return $args->export();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user