Skip to content

Commit

Permalink
Base classes instead of cond loading for Advanced Tables
Browse files Browse the repository at this point in the history
  • Loading branch information
adrolli committed Jun 20, 2024
1 parent 5a3c7cf commit fc7883b
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 20 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,4 @@
},
"minimum-stability": "dev",
"prefer-stable": true
}
}
8 changes: 7 additions & 1 deletion packages/core/config/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

return [

'use_advanced_tables' => true,
/*
| Set to false to disable advanced tables
| If true, the advanced tables plugin will be
| automatically loaded, if it is installed and enabled
| https://filamentphp.com/plugins/kenneth-sese-advanced-tables
*/
'use_advanced_tables' => false,

];
15 changes: 15 additions & 0 deletions packages/core/src/Base/BaseRelationManager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Moox\Core\Base;

use Filament\Resources\RelationManagers\RelationManager;

if (config('core.use_advanced_tables') === true && trait_exists('\Archilex\AdvancedTables\AdvancedTables')) {
class BaseRelationManager extends RelationManager
{
// @phpstan-ignore-next-line
use \Archilex\AdvancedTables\AdvancedTables;

Check failure on line 11 in packages/core/src/Base/BaseRelationManager.php

View workflow job for this annotation

GitHub Actions / phpstan

Class Moox\Core\Base\BaseRelationManager uses unknown trait Archilex\AdvancedTables\AdvancedTables.

Check failure on line 11 in packages/core/src/Base/BaseRelationManager.php

View workflow job for this annotation

GitHub Actions / phpstan

No error to ignore is reported on line 11.
}
} else {
class BaseRelationManager extends RelationManager {}
}
15 changes: 15 additions & 0 deletions packages/core/src/Base/BaseResource.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Moox\Core\Base;

use Filament\Resources\Resource;

if (config('core.use_advanced_tables') === true && trait_exists('\Archilex\AdvancedTables\AdvancedTables')) {
class BaseResource extends Resource
{
// @phpstan-ignore-next-line
use \Archilex\AdvancedTables\AdvancedTables;

Check failure on line 11 in packages/core/src/Base/BaseResource.php

View workflow job for this annotation

GitHub Actions / phpstan

Class Moox\Core\Base\BaseResource uses unknown trait Archilex\AdvancedTables\AdvancedTables.

Check failure on line 11 in packages/core/src/Base/BaseResource.php

View workflow job for this annotation

GitHub Actions / phpstan

No error to ignore is reported on line 11.
}
} else {
class BaseResource extends Resource {}
}
15 changes: 15 additions & 0 deletions packages/core/src/Base/BaseWidget.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Moox\Core\Base;

use Filament\Widgets\TableWidget;

if (config('core.use_advanced_tables') === true && trait_exists('\Archilex\AdvancedTables\AdvancedTables')) {
class BaseWidget extends TableWidget
{
// @phpstan-ignore-next-line
use \Archilex\AdvancedTables\AdvancedTables;

Check failure on line 11 in packages/core/src/Base/BaseWidget.php

View workflow job for this annotation

GitHub Actions / phpstan

Class Moox\Core\Base\BaseWidget uses unknown trait Archilex\AdvancedTables\AdvancedTables.

Check failure on line 11 in packages/core/src/Base/BaseWidget.php

View workflow job for this annotation

GitHub Actions / phpstan

No error to ignore is reported on line 11.
}
} else {
class BaseWidget extends TableWidget {}
}
18 changes: 0 additions & 18 deletions packages/core/src/Traits/UseAdvancedTables.php

This file was deleted.

0 comments on commit fc7883b

Please sign in to comment.