Exclude models from dataprovider

Is there a way to exclude certain models from a dataprovider?

I have a listview widget that shows a post feed similar to a Facebook feed. Some of the content can be video. I’m storing a vimeo or youtube url in the db. Upon retrieval from the db, I do a get request to check that the video is functional and retrieve the embed html. The problem is when a video is not accessible, for example due to privacy settings, the listview shows a blank item. I can just hide the html, but the pager still shows there should be a model there.

Either implement custom data provider or create a background job (crontab) that will check videos and set a flag “is_accessible” in the database. Then filter it.


Writing my own dataprovider sounds like a wonderful learning experience. :grin:

Crontab sounds like a simple and quick solution for now. Thanks!