Thursday, March 30, 2017

updating counter increment when click on link in laravel

I have an audio file on public folder like this-

 @foreach ($songs as $song)
     <a href="" download="" >
        <button type="button" class="btn btn-xs btn-info download" style="margin-bottom: 15px;">
           <i class="glyphicon glyphicon-download">Download</i>
        </button>
     </a>
 @endforeach

So, when i click that button it downloads the song. i have a song database where i put the song and a column download_count set to default(0). I want to increase the download_count every time the button is clicked. so how can i pass this logic to controller for updating the database?



via Himu

Advertisement