FareedR
5 months ago

Getting "Trying to get property of non-object" in blade view.

Posted 5 months ago by FareedR

I did test of my relation in laravel tinker . i get what i want . but in blade , i get an error for it . is there anything that i do wrong ?

<td class="text-center">
    <span class="badge badge-warning">{{ $club->president->name }}</span>
</td>
          
Relation in Club Model 
         
public function president()
    {
        return $this->belongsTo(Student::class,'president_id','id');
    }           

Please sign in or create an account to participate in this conversation.