Getting table data from api with parameter from the logged in user

Hi!
Im having trouble getting the package calebporzio/sushi to get my data and display it in my resource.
Here is my code:
Application Model
class Application extends Authenticatable
{
    use Sushi;

    protected static array $municipality_id = [];

    public static function queryForMunicipalityId($id): Builder
    {
        static::$municipality_id = [$id];

        return static::query();
    }

    public function getRows()
    {
        if (!static::$municipality_id) {
            return [];
        }

        $applications = Http::get(env('ERP_URL').'applications/'.static::$municipality_id)->json();

        return $applications['data'];
    }
}


In the ApplicationResource i have this function:
public static function getEloquentQuery(): Builder
{
    return Application::queryForMunicipalityId(auth()->user()->municipality_id);
}


I also tried this in the MangeApplication Page like this:
    protected function getTableQuery(): Builder
    {
        return Application::queryForMunicipalityId(auth()->user()->municipality_id);
    }


The api works fine if hardcode the ID in the url of the api (without the if statement) but the getRows does not seem to get fired again even when i'm applying filters or something.
I used this example: How to use Eloquent's sushi, but the data is dynamic from API?

Does anyone know if it is possible to get the table data with information from the logged in user?
If you need more information please let me know!
Was this page helpful?