I am have 2 models, a Project model and a User models, a User can have many projects,
The relationship looks a little like this,
public function myProjects($archived = false) {
if ($archived) return $this->belongsToMany('Project', 'project_user', 'user_id', 'project_id')->withPivot(['last_opened as last_opened','role as role']);
else return $this->belongsToMany('Project', 'project_user', 'user_id', 'project_id')->where('projects.archived_at', '=', "0000-00-00 00:00:00")->withPivot(['last_opened as last_opened','role as role']);
}
A Project also belongs to an Organisation, this is where my problem starts, the projects that are returned here also include Projects that belong to Organisation that have been soft deleted, and I don't want it too, is there a way I can select only the projects with organisations that don;t have a deleted at date?