lundi 27 février 2017

Error in Relationship of tables

Im having a error when i try to get some data between 2 tables using eloquent. The error that is giving me is:

Error:
Trying to get property of non-object (View: 

This is my app information

DB:
survey:
- id;
- template_id;
- title;


templates:
- id;
- name;
- internal_name;

SurveyModel:
 public function theme(){

        return $this->hasOne(Template::class, 'template_id','id');
}


View:

@foreach($surveys->reverse() as $survey)

        <tr>
        <td></td>

</tr>
@endforeach



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire