Issue
I have stored a column as an array but when I received this from server in ionic, ionic will deal with it as a string and not array
this is how it's stored
["loca6_1.jpeg","loca6_1.jpeg"]
here is the backend function and it is written in php laravel
return Auth::user()->attachments()->pluck('filename');
and database we're using phpMyadmin
Solution
Try casting the column to an array:
Attachment.php
protected $casts = [
'filename' => 'array',
];
This is untested, but I think you'd need to do something like this to merge all the individual arrays in to one.
return Auth::user()->attachments()->pluck('filename')->flatten();
Answered By - martincarlin87
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.