I find this error on local development machine. I can see the details of this in the database but when i try to list all the jobs it breaks. So I think it is a something in a way database objects are stored. It gives m error on index.blade.php :
@foreach ($jobs as $job)
<article class="space-y-4">
<a href="jobs/{{$job['id']}}" class="block px-4 py-6 border border-gray-200 rounded-lg">
<div class="font-bold text-blue-500 text-sm">{{$job->employer->name}}</div>
<div>
<li>
{{ $job['title'] }}: Pays {{$job['salary']}} per year
</li>
</div>
</a>
</article>
@endforeach
<div>
{{$jobs->links()}}
</div>
I need more information to help you effectively. However, the problem seems to be in the relationship between the Job model and the Employer model. Make sure your Job model is defined like this:
class Job {
public function employer()
{
return $this->belongsTo(Employer::class);
}
}
Another thing to remember is that $job->employer can be null depending on the relationships in the database. So, it's important to validate it, like this: {{$job->employer->name ?? ''}}