I am using PostgreSQL on a Laravel installation. A table has a bytea type field which is being used to store binary data (base64_encoded file contents).
When I use Eloquent to retrieve the table I get a resource type variable being returned in this field.
How can I rather retrieve this as a string?
$raw = Media::where('id','=',$id)->first();
$raw->file_data = base64_decode($raw->file_data); // doesn't work
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…