public function select($id)
 {
     if (Auth::check()) {
         $song = \App\Song::find($id);
         $this->push($song->url_source);
         return redirect('playlists');
     } else {
         return redirect(url());
     }
 }
 public function Listen($song_id)
 {
     $song = Song::find($song_id);
     if (count($song)) {
         $song->listen_count++;
         $song->save();
         return Response()->json(array('data' => $song), 200);
     } else {
         return Response()->json(array('message' => 'Song not Found'), 404);
     }
 }
 public function destroy($id)
 {
     $song = Song::find($id);
     $song->delete();
     return redirect('admin/song');
 }
Exemple #4
0
 public function show($id)
 {
     $song_name = Song::find($id);
     return view('songs.show', compact('song_name'));
 }
Exemple #5
0
 public function favorites($id)
 {
     $song = Song::find($id, ['id', 'title']);
     $favorites = Songfav::with(['user' => function ($query) {
         $query->select('id', 'name');
     }])->select('user_id', 'created_at')->where('song_id', $id)->orderBy('created_at')->paginate(20);
     return view('song.favorites', ['song' => $song, 'favorites' => $favorites]);
 }
 public function EditMySong()
 {
     $song_id_edit = Input::get('song_id_edit');
     $singer_name_input = Input::get('singer_name_input');
     $song_name_input = Input::get('song_name_input');
     $image_change = Input::file('image_change');
     if ($image_change != null) {
         $filename = $image_change->getClientOriginalName();
         $path = public_path('uploadedImage/');
         $flnm = str_replace(' ', '', $filename);
         $image_url = 'uploadedImage/' . $flnm;
         $song = Song::find($song_id_edit);
         if (count($song) && $image_change->move($path, $flnm)) {
             $song->singer = $singer_name_input;
             $song->song_name = $song_name_input;
             $song->image_url = $image_url;
             $song->save();
         }
     } else {
         $song = Song::find($song_id_edit);
         if (count($song)) {
             $song->singer = $singer_name_input;
             $song->song_name = $song_name_input;
             $song->save();
         }
     }
     return Redirect::Route('edit-songs');
 }
Exemple #7
0
 public function create(Request $request)
 {
     $song = Song::find($request->input('song'), ['id', 'title']);
     return view('songrev.create', ['song' => $song]);
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function getIndex()
 {
     $song = \App\Song::find($_GET['id']);
     return view('templates.ajaxsong')->with('song', $song);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     if (Auth::check()) {
         $song = \App\Song::find($id);
         unlink($song->url_source);
         $song->delete();
         return redirect('songs');
     } else {
         return redirect(url());
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $song = \App\Song::find($id);
     unlink($song->url_source);
     $song->delete();
     return redirect('songs');
 }
Exemple #11
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($song_id)
 {
     Song::find($song_id)->delete();
     return redirect('songs');
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $song = Song::find($id);
     $song->delete();
     return $this->index();
 }
Exemple #13
0
 public function create(Request $request)
 {
     $this->validate($request, ['song' => 'required']);
     $song = Song::find($request->input('song'), ['id', 'title']);
     return view('songfav.create', ['song' => $song]);
 }
 public function details($id)
 {
     $songs = Song::find($id);
     return view('songs.details', compact('songs'));
 }
 public function select($id)
 {
     $song = \App\Song::find($id);
     $this->push($song->url_source);
     return redirect('playlists');
 }