$file = base_path('storage/app/public/uploads/images/profiles/2d1c6f0b5d3b5ffdea70f44e4364281b.jpeg');
$filename = $file;
$handle = fopen($filename, "rb");
$contents = fread($handle, filesize($filename));
fclose($handle);
header("content-type: image/jpeg");
echo $contents;
public function allAttributesUp()
{
$ids = $this->ancestors->pluck('id')->merge($this->id)->toArray();
$parentAttributes = Attribute::whereHas('services', function ($q) use ($ids) {
$q->whereIn('services.id', $ids);
})->groupBy('id')->get();
return $parentAttributes;
}