Vinelab / NeoEloquent

The Neo4j OGM for Laravel
MIT License
633 stars 199 forks source link

how to delete relationship using neoEloquent? #201

Closed sreesshylam closed 7 years ago

KinaneD commented 7 years ago

Take a look here: https://github.com/Vinelab/NeoEloquent#working-with-edges

sreesshylam commented 7 years ago

remove a single relation from group of relation

Mulkave commented 7 years ago

@sreesshylam can you give a code example of what you wish to achieve please.

sreesshylam commented 7 years ago

$ads = Ads::find(123); $tag =$ads->tags()->get(); //get all tags relates to ads

how to remove the relation from the 'Taged' from the ads

i use this code but the tags removed form the corresponding node
foreach ($tag as $key => $value) { $value->delete(); }

i need only relation removed from Ads

ctorresr commented 7 years ago

foreach ($ads->tags()->edges() as $relation) { $relation->delete(); }

sreesshylam commented 7 years ago

i have also one dbt how to convert cypher query (MATCH p=(Ads)-[r:TAGS]->(Tags)<-[r1:INTERESTED]-(User) RETURN p) to corresponding NeoEloquent

ctorresr commented 7 years ago

@sreesshylam You can also use raw cypher for more complicated query's. Create a stored procedures class and give it a try.