I need help getting the JSON download_link from the front end of my application, in the previous laravel it did not get this JSON now I'm not able to remove the url from the file
Please if anyone could help me I would be very weak, I have been using the voyager for a long time and I really like it
Explain what the hell you're wanting to do and what the download_link is?
First you say you want to 'remove' it then 'getting' it.
Some pardon must have been some problem with google translator, I'm from Brazil and my English is not so good.
Then I have a table in a file of a type file in my BREAD, but when I upload the same file it will be in a format like this "[{" download_link ":" editordata / April2018 /Pu3SlfaJdCJNEXJd01wQ.pdf "," original_name ": "Boleto Online.pdf"}] ", I can not get my front-end site to get the download link.
In the previous version when uploading a file it was only the path, not the dowload_link and original name.
English is not my first language either.
I would suggest:
Keep sentences short.
Attach some pictures of your BREAD configuration, what it's happening and what you want to happen.
I'm a bit late here, but @bbashy, please watch the tone of your comment. "Explain what the hell you're wanting to do" is extremely confrontational and is not necessary.
@fletch3555 I'll watch it
having the same issue like Imoraes22
I have a table that i created via Voyager named documents.
One column in the table is called document, and the type is file.
The data value that Voyager is storing in the table in that column is a JSON object
[{"download_link":"documents\June2018\uAt2PejxwlKWhcE0PtCP.pdf","original_name":"VLDS_Arch_Final_Report.pdf"}]
Now, i am also trying to put a link on the front end that would enable me to click the link and open
the document, but it just doesnt't work like this :
<div class="list-group">
@foreach($projectDocuments as $doc)
<a href=" {{ $doc->document }}" target="_blank" class="list-group-item list-group-item-action flex-column align-items-start">
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1"><i class="fas fa-file-pdf mr-3"></i> {{ $doc->name }}</h5>
<span class="time">{{ $project->updated_at->format('d-m-Y') }} | <b class="text-primary">{{ $project->updated_at->format(' H:i:s') }} </b></span>
</div>
</a>
@endforeach
</div>
Any If would be much appreciated, since there is no help in the Voyager documentation :)
I think you can check how it's done here: https://github.com/the-control-group/voyager/blob/d64767eb5958db1d9014f159550587b9997aad2c/resources/views/bread/browse.blade.php#L157
Thank you MrCrayon, already made it work with
You've got json inside your database column, so you have to decode it first and then approach to it as to array. For example I created an Laravel public function getDocumentAttribute($document_json) where I return back json_decode($document_json). So everytime you try to get value of this document column from model, you have Array prepared. Then simply print $doc->document[0]['download_link'] in your view.
Already done it, but thanx for your suggestion anyway, much appreciated :)
On Fri, Aug 31, 2018 at 12:25 PM AlterwebStudio notifications@github.com
wrote:
You've got json inside your database column, so you have to decode it
first and then approach to it as to array. For example I created an Laravel
public function getDocumentAttribute($document_json) where I return back
json_decode($document_json). So everytime you try to get value of this
document column from model, you have Array prepared. Then simply print
$doc->document[0]['download_link'] in your view.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/the-control-group/voyager/issues/3029#issuecomment-417622327,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AQ2MtUz6LHPWySgf-ltghTsR33fsEXaIks5uWQ8sgaJpZM4TeeOQ
.
Yeah, no problem. Maybe for somebody else in the future who will face the same problem... :)
Odoslané z iPhonu
Dňa 3. 9. 2018 o 0:48 užÃvateľ edis notifications@github.com napÃsal:
Already done it, but thanx for your suggestion anyway, much appreciated :)
On Fri, Aug 31, 2018 at 12:25 PM AlterwebStudio notifications@github.com
wrote:You've got json inside your database column, so you have to decode it
first and then approach to it as to array. For example I created an Laravel
public function getDocumentAttribute($document_json) where I return back
json_decode($document_json). So everytime you try to get value of this
document column from model, you have Array prepared. Then simply print
$doc->document[0]['download_link'] in your view.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/the-control-group/voyager/issues/3029#issuecomment-417622327,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AQ2MtUz6LHPWySgf-ltghTsR33fsEXaIks5uWQ8sgaJpZM4TeeOQ
.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
Closing as the issue seems resolved.
This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.
Most helpful comment
Thank you MrCrayon, already made it work with
Will try your solution too