Ejemplo n.º 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(CreateSong $request)
 {
     $file = \Input::file('url');
     if ($file !== null) {
         $extencion = \Input::file('url')->getClientOriginalExtension();
         if ($extencion == "mp3" || $extencion == "wav") {
             $song = \App\Models\Song::create(\Input::all());
             $destinationPath = '' . env('SONGURL') . "/" . $song->id_singer . '/';
             \Input::file('url')->move($destinationPath, $song->id . '.' . $extencion);
             $song->url = $extencion;
             $song->save();
             return redirect('songs');
         } else {
             return \Redirect::back()->withErrors(["File  can only upload with extension mp3,wav"]);
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(StoreSongRequest $request)
 {
     $song = Song::create($request->all());
     $type = 'song';
     // is this a videoclip or slideshow?
     if ($song->title_2 == 'video' || $song->title_2 == 'slides') {
         $song->update(['license' => 'PD']);
         $type = $song->title_2;
     }
     if ($type == 'song') {
         flash('New Song or Item added: ' . $request->title);
         return \Redirect::route($this->view_idx);
     }
     // since we just create a new slide or clip, we go back to the list of slides or clips!
     flash('New ' . $song->title_2 . ' added, titled: ' . $request->title);
     return redirect()->route($this->view_idx, ['filterby' => 'title_2', 'filtervalue' => $song->title_2]);
 }