@eliekhazzaka the accessor you've added should give you the extra field on your user model.
you'd access it via:
$image = $user->imageString;
what are you using the helper for?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
i create a helper called: FaceImageHeller:
$type = pathinfo($path, PATHINFO_EXTENSION);
$data = file_get_contents($path);
$base64 = 'data:face_image/' . $type . ';base64,' . base64_encode($data);
return $base64;
}
and in Users modal i put those:
protected $appends = ['imageString'];
public function getImageStringAttribute() {
$type = pathinfo($this->image, PATHINFO_EXTENSION);
$data = file_get_contents($this->image);
$base64 = 'data:face_image/' . $type . ';base64,' . base64_encode($data);
return $base64;
and then put in the validation Face_image should i put something else ?? are they correct?? what should i do next??
@eliekhazzaka GET method being GET user ?
eg:
/user/{user}
if so, sure.
You can access
$user->imageString
from anywhere you have the user object.
Please or to participate in this conversation.