Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace Filament\Tables\Concerns; use Filament\Forms\Components\Checkbox; use Fi..
Decoded Output download
<?php
namespace Filament\Tables\Concerns;
use Filament\Forms\Components\Checkbox;
use Filament\Forms\Form;
use Illuminate\Support\Arr;
/**
* @property Form $toggleTableColumnForm
*/
trait CanToggleColumns
{
/**
* @var array<string, bool | array<string, bool>>
*/
public array $toggledTableColumns = [];
/**
* @return array<string, bool | array<string, bool>>
*/
protected function getDefaultTableColumnToggleState(): array
{
$state = [];
foreach ($this->getTable()->getColumns() as $column) {
if (! $column->isToggleable()) {
continue;
}
data_set($state, $column->getName(), ! $column->isToggledHiddenByDefault());
}
return $state;
}
public function updatedToggledTableColumns(): void
{
session()->put([
$this->getTableColumnToggleFormStateSessionKey() => $this->toggledTableColumns,
]);
}
public function getTableColumnToggleForm(): Form
{
if ((! $this->isCachingForms) && $this->hasCachedForm('toggleTableColumnForm')) {
return $this->getForm('toggleTableColumnForm');
}
return $this->makeForm()
->schema($this->getTableColumnToggleFormSchema())
->columns($this->getTable()->getColumnToggleFormColumns())
->statePath('toggledTableColumns')
->live();
}
/**
* @return array<Checkbox>
*/
protected function getTableColumnToggleFormSchema(): array
{
$schema = [];
foreach ($this->getTable()->getColumns() as $column) {
if (! $column->isToggleable()) {
continue;
}
$schema[] = Checkbox::make($column->getName())
->label($column->getLabel());
}
return $schema;
}
public function isTableColumnToggledHidden(string $name): bool
{
return Arr::has($this->toggledTableColumns, $name) && ! data_get($this->toggledTableColumns, $name);
}
public function getTableColumnToggleFormStateSessionKey(): string
{
$table = class_basename($this::class);
return "tables.{$table}_toggled_columns";
}
/**
* @deprecated Override the `table()` method to configure the table.
*
* @return int | array<string, int | null>
*/
protected function getTableColumnToggleFormColumns(): int | array
{
return 1;
}
/**
* @deprecated Override the `table()` method to configure the table.
*/
protected function getTableColumnToggleFormWidth(): ?string
{
return null;
}
/**
* @deprecated Override the `table()` method to configure the table.
*/
protected function getTableColumnToggleFormMaxHeight(): ?string
{
return null;
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace Filament\Tables\Concerns;
use Filament\Forms\Components\Checkbox;
use Filament\Forms\Form;
use Illuminate\Support\Arr;
/**
* @property Form $toggleTableColumnForm
*/
trait CanToggleColumns
{
/**
* @var array<string, bool | array<string, bool>>
*/
public array $toggledTableColumns = [];
/**
* @return array<string, bool | array<string, bool>>
*/
protected function getDefaultTableColumnToggleState(): array
{
$state = [];
foreach ($this->getTable()->getColumns() as $column) {
if (! $column->isToggleable()) {
continue;
}
data_set($state, $column->getName(), ! $column->isToggledHiddenByDefault());
}
return $state;
}
public function updatedToggledTableColumns(): void
{
session()->put([
$this->getTableColumnToggleFormStateSessionKey() => $this->toggledTableColumns,
]);
}
public function getTableColumnToggleForm(): Form
{
if ((! $this->isCachingForms) && $this->hasCachedForm('toggleTableColumnForm')) {
return $this->getForm('toggleTableColumnForm');
}
return $this->makeForm()
->schema($this->getTableColumnToggleFormSchema())
->columns($this->getTable()->getColumnToggleFormColumns())
->statePath('toggledTableColumns')
->live();
}
/**
* @return array<Checkbox>
*/
protected function getTableColumnToggleFormSchema(): array
{
$schema = [];
foreach ($this->getTable()->getColumns() as $column) {
if (! $column->isToggleable()) {
continue;
}
$schema[] = Checkbox::make($column->getName())
->label($column->getLabel());
}
return $schema;
}
public function isTableColumnToggledHidden(string $name): bool
{
return Arr::has($this->toggledTableColumns, $name) && ! data_get($this->toggledTableColumns, $name);
}
public function getTableColumnToggleFormStateSessionKey(): string
{
$table = class_basename($this::class);
return "tables.{$table}_toggled_columns";
}
/**
* @deprecated Override the `table()` method to configure the table.
*
* @return int | array<string, int | null>
*/
protected function getTableColumnToggleFormColumns(): int | array
{
return 1;
}
/**
* @deprecated Override the `table()` method to configure the table.
*/
protected function getTableColumnToggleFormWidth(): ?string
{
return null;
}
/**
* @deprecated Override the `table()` method to configure the table.
*/
protected function getTableColumnToggleFormMaxHeight(): ?string
{
return null;
}
}
Function Calls
None |
Stats
MD5 | 6344c65ef948cf1a475bbe3b847de026 |
Eval Count | 0 |
Decode Time | 109 ms |