public function deleteRespostesAssistents($idVotacio, $idAssistent) { $vota = VotacioAssistent::where('assistent_id', '=', $idAssistent)->where('votacio_id', '=', $idVotacio)->first(); if ($vota) { $vota->delete(); } }
public function postAssistentVotacio() { $array = Request::input('vota'); if ($array) { foreach ($array as $vota) { $id = Votacio::where('titol', "=", $vota)->select('id')->first(); $voAs = VotacioAssistent::where('assistent_id', "=", Request::input('id'))->where('votacio_id', '=', $id->id)->get(); if ($voAs->isEmpty()) { $result = array('assistent_id' => Request::input('id')); $result = array_add($result, 'votacio_id', $id->id); $novaVoAs = VotacioAssistent::create($result); } } } }