1. Go to this page and download the library: Download tomatophp/filament-api library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use TomatoPHP\FilamentApi\Traits\InteractWithAPI;
use \Filament\Resources\Pages\ListRecords;
class ListPosts extends ListRecords
{
use InteractWithAPI;
}
// Use to return API JSON Resource on Index/Show/Store/Update
public static function getFilamentAPIResource(): ?string
{
return null;
}
// Use To Custom Your Route Middleware
public static function getFilamentAPIMiddleware(): array
{
return config('filament-api.default_middleware');
}
// Use To Change the Endpoint Slug
public static function getFilamentAPISlug(): ?string
{
return null;
}