So i'm having trouble with deleting an element from database through eloquent of Laravel 5.2
My code is as followed:
public function destroy($language, $id)
{
switch($language) {
case 'nl':
ActivitiesNL::destroy($id);
echo 'Dutch activity Destroyed!! <br>';
break;
case 'en':
ActivitiesEN::destroy($id);
echo 'English activity Destroyed!! <br>';
break;
case 'de':
ActivitiesDE::destroy($id);
echo 'German activity Destroyed!! <br>';
break;
default :
echo 'No activities destroyed... <br>';
throw new BadRequestHttpException('Incorrect request!!');
}
echo 'My job here is done!';
}
the Destroy function deletes an activity from all 3 models.. In my database I have linked them with each other through foreign keys, so i could find the different languages much quicker for each activity..
Is that the reason that Destroy actually deletes the specified activity in all 3 tables and is there a way I can prevent that from happening?
Thanks in advance!!
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire