dimanche 25 octobre 2015

Get download link of a file in Laravel

I made an API in Laravel and it returns Scenario objects as JSON. My problem is that I get all scenario information from database but I also need get files that belongs to spesific scenario with a download link.

Example JSON data:

{
   "scenarios":[
      {
         "id":"A001",
         "translation_mode":"A",
         "language":"EN",
         "difficulty":1,
         "title":"Bankimoon",
         "field":"Siyaset",
         "speaker":"Ban Ki Moon",
         "accent":"Amerikan",
         "duration":"06:24:00",
         "url":"",
         "copyright_status":"podcast",
         "note":""
      },
      {
         "id":"A002",
         "translation_mode":"A",
         "language":"TR",
         "difficulty":1,
         "title":"Dr. \u00d6z",
         "field":"Sa\u011fl\u0131k",
         "speaker":"Mehmet \u00d6z",
         "accent":"Amerikan Aksanl\u0131 T\u00fcrk\u00e7e",
         "duration":"02:11:00",
         "url":"",
         "copyright_status":"youtube download",
         "note":""
      }
   ],
   "status_code":200
}

For example, for ID A001 I have a folder like storage/app/scenarios/A001 and I have an mp3 file and 2 text file. I want to add download links in this folder for all files to my JSON response.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire