Error in extending tables
I would like to extend from Tables for creating my own class (in filament 3)
I created an empty class:
but if I try to use MyTable in this way in a resource file:
I have this error:
And I cannot understand why.
I created an empty class:
namespace App\Tables\Components;
use Filament\Tables\Table;
class MyTable extends Table{
}but if I try to use MyTable in this way in a resource file:
public static function table(MyTable $table): MyTableI have this error:
Declaration of App\Filament\Resources\ExhibitionResource::table(App\Tables\Components\MyTable $table): App\Tables\Components\MyTable must be compatible with Filament\Resources\Resource::table(Filament\Tables\Table $table):And I cannot understand why.
Solution
The
abstract Resource names the specific Table class which must be implemented in that particular scenario, instead of specifying a contract. https://github.com/filamentphp/filament/blob/aa609c8f1214e6c49f1625d006a4d6739bcc2e5c/packages/panels/src/Resources/Resource.php#L151-L154GitHub
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS. - filamentphp/filament