MusicController.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Music;
  4. use Illuminate\Http\Request;
  5. class MusicController extends Controller
  6. {
  7. /**
  8. * Display a listing of the resource.
  9. *
  10. * @return \Illuminate\Http\Response
  11. */
  12. public function index()
  13. {
  14. // list all songs
  15. $songs = Music::all();
  16. return view('home', ['song_list'=>$songs]);
  17. }
  18. public function playlog(Music $music){
  19. // add one to played log
  20. $music->played += 1;
  21. $music->save();
  22. return $music->played;
  23. }
  24. public function dwlog(Music $music){
  25. // add one to download log
  26. $music->downloads += 1;
  27. $music->save();
  28. return $music->downloads;
  29. }
  30. public function null(Music $music){
  31. return null;
  32. }
  33. /**
  34. * Show the form for creating a new resource.
  35. *
  36. * @return \Illuminate\Http\Response
  37. */
  38. public function create()
  39. {
  40. //
  41. }
  42. /**
  43. * Store a newly created resource in storage.
  44. *
  45. * @param \Illuminate\Http\Request $request
  46. * @return \Illuminate\Http\Response
  47. */
  48. public function store(Request $request)
  49. {
  50. //
  51. }
  52. /**
  53. * Display the specified resource.
  54. *
  55. * @param \App\Music $music
  56. * @return \Illuminate\Http\Response
  57. */
  58. public function show(Music $music)
  59. {
  60. //
  61. }
  62. /**
  63. * Show the form for editing the specified resource.
  64. *
  65. * @param \App\Music $music
  66. * @return \Illuminate\Http\Response
  67. */
  68. public function edit(Music $music)
  69. {
  70. //
  71. }
  72. /**
  73. * Update the specified resource in storage.
  74. *
  75. * @param \Illuminate\Http\Request $request
  76. * @param \App\Music $music
  77. * @return \Illuminate\Http\Response
  78. */
  79. public function update(Request $request, Music $music)
  80. {
  81. //
  82. }
  83. /**
  84. * Remove the specified resource from storage.
  85. *
  86. * @param \App\Music $music
  87. * @return \Illuminate\Http\Response
  88. */
  89. public function destroy(Music $music)
  90. {
  91. //
  92. }
  93. }