$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;
}
$prices_min = $this->prices()->limit(1)->orderBy('days')->first();
if($days < $prices_min) {
return $prices_min;
}
$exact_match = $this->prices()->where('days','=',$days)->first();
if($exact_match) {
return $exact_match;
}
$smaller = $this->prices()->where('days','<',$days)->first();
if($smaller) {
return $smaller;
}
throw new NotFoundException('Not Found');
$prices_min = $this->prices()->limit(1)->orderBy('days')->first();
if($days < $prices_min) {
$price = $prices_min;
}
$exact_match = $this->prices()->where('days','=',$days)->orWhere('days','<',$days)->orderByDesc('days')->first();
if($exact_match) {
$price = $exact_match;
}