Refactor table components to use GenericTableSettings and remove deprecated classes
This commit is contained in:
@@ -4,8 +4,10 @@ namespace App\Tables\Extensions;
|
||||
|
||||
use Closure;
|
||||
use Mmt\GenericTable\Attributes\MappedRoute;
|
||||
use Mmt\GenericTable\Interfaces\ICellData;
|
||||
use Mmt\GenericTable\Interfaces\IColumn;
|
||||
use Mmt\GenericTable\Interfaces\IColumnRenderer;
|
||||
use Mmt\GenericTable\Interfaces\IRowData;
|
||||
use Str;
|
||||
|
||||
class IconColumn implements IColumn, IColumnRenderer
|
||||
@@ -20,17 +22,19 @@ class IconColumn implements IColumn, IColumnRenderer
|
||||
|
||||
private Closure $setIconCallback;
|
||||
|
||||
public int $columnIndex;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
if($this->databaseColumnName == null)
|
||||
$this->databaseColumnName = Str::snake($this->columnTitle);
|
||||
}
|
||||
|
||||
public function renderCell(\Illuminate\Database\Eloquent\Model $rowModel): string
|
||||
public function renderCell(ICellData $cell, IRowData $row): string|null
|
||||
{
|
||||
$icon = 'bi bi-arrow-up-right-circle-fill';
|
||||
if(isset($this->setIconCallback))
|
||||
$icon = $this->setIconCallback->call($this, $rowModel);
|
||||
$icon = $this->setIconCallback->call($this, $row);
|
||||
|
||||
return <<<HTML
|
||||
<div class = "w-100 d-flex justify-content-start">
|
||||
|
||||
Reference in New Issue
Block a user