Support the ongoing development of Laravel.io →
posted 8 years ago
Eloquent
Last updated 1 year ago.
0

Obviously, I don't know much of the background to the original poster's question, but to me, this looks like something better handled in a scope.

public function tasks() {
    return $this->hasMany('Tasks','startTarget')->orWhere('endTarget','=',$this->id);
}

public function scopeOpen($query) {
    return $query->where('status', '=', 0);
}

Then retrieval would look something like:

$target->tasks()->open()->get();
Last updated 8 years ago.
0

I am interested in this as well. Any updates?

Thank you

0

Sign in to participate in this thread!

Eventy

Your banner here too?

0lide 0lide Joined 13 May 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.