public function order
{
return $this->belongsTo('App\Order');
}
public function order
{
return self::query()->where('cost', '>', $this->cost);
}
matchMany($models, $queryResults, $relation, $related, $foreignKey, $primaryKey)
public function relatedOrders()
{
return $this->hasMany(self::class, "parent_id", "id")->fromHighPriceOrders();
}
public function scopeCost($query,$value)
{
return $query->where('cost', '>', $value);
}
$data = Order::cost(100)->get();