Support the ongoing development of Laravel.io →
Database Eloquent Forms
Last updated 2 years ago.
0

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.

Last updated 2 years ago.
0

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 :)

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

lostbyte lostbyte Joined 13 Sep 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.