Currently i having two model, Roundtable and Table Category, i created a relationship between them with the code below.
Table category model
public function roundtables(){
return $this->hasMany('App\Roundtable');
}
Roundtable Model
public function table_category()
{
return $this->belongsTo('App\Table_Category');
}
This should connect them right?
But when i trying to get the value with
$table->table_category->name
It will occur error "Trying to get property of non-object".
Can i know what is the problems?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire