public function addLyrics($songID) { $song = Song::find($songID); if ($song == null) { return Redirect::route('albums-home')->with('fail', "That song doesn't exist."); } if (Input::get('lyricsEditor') == '') { return Redirect::route('albums-home')->with('fail', "You didn't type anything."); } $lyrics = new Lyric(); $lyrics->song_id = $songID; $lyrics->lyrics = Input::get('lyricsEditor'); $lyrics->author_id = Auth::user()->id; $action = new Action(); $action->song_title = $song->title; $action->action = "Added lyrics"; $action->user_id = Auth::user()->id; if ($lyrics->save() && $action->save()) { return Redirect::route('albums-home')->with('success', 'The lyrics were added.'); } else { return Redirect::route('albums-home')->with('fail', 'An error occured while saving the lyrics.'); } }
public function __clone() { $lyric = new Lyric(); $lyric->copyFrom($this); return $lyric; }