I want to modify some values of my query result for API call. here's my query
public function modules()
{
Module::select('id','name','image')->get()->toJson();
}
so I want to modify image value, add full path to it. I added accessor
public function getImageAttribute($image)
{
return asset($image);
}
and it works fine, but the problem is now it will be affecting this column every time i try to retrieve it. is there way to use this accessor(getImageAttribute) only for modules method?