File::where('type', $type)
->whereHas('products', function ($query) {
$query->where('slug', '=', $product_slug);
})
->first();
или
File::select('files.*')
->leftJoin('products' ... условия джоина)
->where('files.type', $type)
->where('products.slug', $product_slug)
->first();