$file=Auth::user()
->products()
->where('slug',$product_slug)
->firstOrFail()
->files()
->where('slug', $file_slug)
->firstOrFail();
$file=File::where('slug', $file_slug)
->whereHas('product', function ($query) use ($product_slug) {
$query->where('products.user_id', '=', Auth::id());
$query->where('products.slug', '=', $product_slug);
})
->firstOrFail();