Answer the question
In order to leave comments, you need to log in
How to attach by id?
There is a store function, how do I attach by id
$dev = Category::find(1);
$dev->post()->attach(3);
Answer the question
In order to leave comments, you need to log in
$cat = Category::find(1);
$cat->post()->attach($cat->id);
// Но по логике должно бить ..->posts()->... в место ...->post()->... :)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question