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



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

Aucun commentaire:

Enregistrer un commentaire