Skip to content

Delete all not updated against sync() #5

@Siebov

Description

@Siebov

Hello. You are using

RecipeIngredient::whereNotIn('id',$ingredients_updated)
            ->where('recipe_id',$recipe->id)
            ->delete();

        RecipeDirection::whereNotIn('id',$directions_updated)
            ->where('recipe_id',$recipe->id)
            ->delete();

and why not just

$recipe->ingredients()->sync($ingredients_updated);
$recipe->directions()->sync($directions_updated);

insted?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions