public function tasksActive($user) { return $this->belongsToMany(Task::getClass(), 'task_user')->wherePivot('status', 1)->wherePivot('user_id', $user); }
public function tasks() { return $this->belongsToMany(Task::getClass())->withPivot('status', 'menu_id'); }