mercredi 23 août 2017

Trouble with a relationship

I am getting an error that suggests a problem with a relationship. the error: Relationship method must return an object of type. How do i fix this?

I have two tables - Batsmen : id, name, countries_id - Country: id, name

my relationship:

Batsmen model:

 public function countries(){
        $this->belongsTo('App\Country','countries_id');
    }

Country model:

 public function batsmen(){
        $this->hasMany('App\Batsmen');
    }

I am trying to get the country name to show on a batsmens profile with

<p> </p>



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2iqX7Ld
via IFTTT

Aucun commentaire:

Enregistrer un commentaire