58 lines
1.9 KiB
PHP
58 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Tables;
|
|
|
|
use App\Models\Product;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Mmt\GenericTable\Components\Column;
|
|
use Mmt\GenericTable\Components\ColumnCollection;
|
|
use Mmt\GenericTable\Interfaces\IBulkAction;
|
|
use Mmt\GenericTable\Interfaces\IGenericTable;
|
|
use Mmt\GenericTable\Support\BulkAction;
|
|
use Mmt\GenericTable\Support\BulkActionCollection;
|
|
use Mmt\GenericTable\Support\BulkActionGroup;
|
|
use Mmt\GenericTable\Support\BulkActionSettings;
|
|
|
|
class TableWithBulkActions implements IGenericTable, IBulkAction
|
|
{
|
|
public Model|string $model;
|
|
|
|
public ColumnCollection $columns;
|
|
|
|
public BulkActionCollection $bulkActionCollection;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->model = new Product();
|
|
|
|
$this->columns = ColumnCollection::make(
|
|
new Column('Id'),
|
|
new Column('Description'),
|
|
new Column('Price'),
|
|
new Column('Stock'),
|
|
new Column('Department', 'subDepartment.department.name'),
|
|
new Column('SubDepartment', 'subDepartment.name'),
|
|
);
|
|
|
|
|
|
|
|
$this->bulkActionCollection = BulkActionCollection::make(
|
|
BulkActionGroup::make('Emails',
|
|
BulkActionGroup::make('FxLive',
|
|
BulkActionGroup::make('Marketing',
|
|
BulkAction::make('100:1 Boost Fund', fn($e) => $this->ProcessMassiveEmailMarketing($e)),
|
|
BulkAction::make('100:2 Boost Fund', fn($e) => $this->ProcessMassiveEmailMarketing($e)),
|
|
BulkAction::make('100:3 Boost Fund', fn($e) => $this->ProcessMassiveEmailMarketing($e)),
|
|
),
|
|
BulkAction::make('100:3 Boost Fund', fn($e) => $this->ProcessMassiveEmailMarketing($e)),
|
|
)
|
|
)
|
|
);
|
|
}
|
|
|
|
|
|
public function ProcessMassiveEmailMarketing(BulkActionSettings $bulkActionSettings)
|
|
{
|
|
dd('Processing action ... ', $bulkActionSettings);
|
|
}
|
|
} |