hasMany does not work correctly

0

Good evening !! I'm trying to launch data relationships (groups and networks) but it does not work ... the group model looks like this:

function Redes(){
     return $this->hasMany('App\rede','grupo_id','id');
}

In the network model it looks like this:

class rede extends Model
{
  protected $table = "redes";
}

I'm trying to display the data like this:

function Index (groups $ groups, network $ network) {

    $lista = $grupos->all();
    foreach($lista as $li):

        foreach($li->Redes() as $d):
            print_r($d->id);
       endforeach;

    endforeach;
}

and nothing, what's wrong ?? Thanks for the constant attention !!!

    
asked by anonymous 07.09.2018 / 00:48

0 answers