i have the following model:
class Agent extends Eloquent
{
protected $fillable = [];
protected $table = 'agents';
protected $primaryKey = 'id_user';
protected $userTable = 'users';
public function user()
{
return $this->hasOne('Cartalyst\Sentry\Users\Eloquent\User', 'id', 'id_user');
}
public function plans()
{
return $this->belongsToMany('Plan', 'agents_plans', 'id_user', 'id_plan');
}
public function promotions()
{
return $this->belongsToMany('Promotion', 'agents_promotions', 'id_user', 'id_promotion');
}
public function sales()
{
return $this->hasMany('Sale', 'id_user');
}
}
how can i delete a record from one of the relational tables like agents_plans?
Everything is beautifully described here: http://laravel.com/docs/4.2/eloquent#inserting-related-models
Read the docs, then ask.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community