Laravel Resource hashid changes when using filters

Viewed 8

I'm using a scope via the URL when getting a list of projects with metadata. Without the scope I get all results & relationship data as I would expect. When using the scope I get the results I would expect however the hashid has changed (it doesn't exist when searching around either) and the related data which I would also expect is gone.

I'm defining my scope

This is what my URL looks like (with filter being the scope):

/api/v2/projects?include=metadata&filter[OutOfSync]=true

This is the query the filter is executing:

return $query->join('metadata', 'projects.id', '=', 'metadata.metable_id')
            ->with('metadata')
            ->where('projects.updated_at', '>', \DB::raw('metadata.value'))
            ->where('metadata.key', '=', 'sync_date');

This is how I'm defining the scope within ProjectSchema::filters:

Scope::make('OutOfSync'),

Any ideas what could be causing this weird behaviour?

0 Answers
Related