15-12-2017

Laravel Toggle

Laravel Toggle

Laravel provides a toggle method which "toggles" the attachment status of the given IDs. If the given ID is currently attached, it will be detached. Likewise, if it is currently detached, it will be attached

$this->podcast = Podcast::find($podcast_id);
if($this->podcast) {
return $this->user->podcast_like()->toggle([$podcast_id],false);
}
return false;