You might have to include the field names that the tables join on as the second and third parameters of belongsTo and hasMany functions. I had a similar issue because my table was named categories and my column in the other table was named category_id, not categories_id. Once I included the field names to join on it worked.
AddWebSolution said:
@sabina2nistor: Problem with blade file so place your blade file code too.@extends('main')
@section('title','| $post->title ')
@section('content')
<div class="row"> <div class="col-md-8"> <h2>{{ $post->title }}</h2> <p>{{ $post->body }}</p> <hr> <p>Category: {{$post->category->name}}</p> </div> </div>this is view file . p.s em not the questioner but answer seeker
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community