Hi, Diego. This is solution 4 you:
class Categoria extends Eloquent {
protected $table = 'categorias';
public function subcategorias()
{
return $this->hasMany('Subcategoria', 'categoria_id');
}
public function anuncios()
{
return $this->hasManyThrough('Anuncio', 'Subcategoria', 'categoria_id', 'subcategoria_id');
}
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community