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

Posted 1 month 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>
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.

Reply to

Use Markdown with GitHub-flavored code blocks.