You can use sync() and attach()
Take a look at the docs: http://laravel.com/docs/4.2/eloquent#relationships
This is their example:
// Adding Pivot Data When Syncing
// You may also associate other pivot table values with the given IDs:
$user->roles()->sync(array(1 => array('expires' => true)));
Let me know if this doesn't make any sense.
As far as I understand I should include these in my Post
controller:
$tag = new Tag;
$tag->name = Input::get('post_tag');
$post = Post::find(1);
$tag = $post->tags()->attach(1)
Is it true? I have no idea :)
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community