In Laravel 4, how do I get a model pivot tableto trigger saved / saved model events when connecting or disconnecting?
It seems that the “TeamUser” pivot table below is not really needed for the attach / detach methods to work, so assuming I believe that the model representing the pivot table is never called. And so events never fire.
To ask another way: When I call User::with('Team')->find(1)->teams()->attach(1);, how to get TeamUserto trigger his own events. Please note that the above application works fine, all records are updated in the database.
User
class User extends Eloquent
{
public function teams()
{
return $this->belongsToMany('Team');
}
}
class Team extends Eloquent
{
public function users()
{
return $this->belongsToMany('User');
}
}
. TeamUser /
class TeamUser extends Eloquent
{
public function save(array $options = array())
{
}
}