'ErrorException Trying to get property 'nom_service' of non-object [closed]

pls help I tried the maximum ways but no result, I'm beginner in laravel!!!

liste.blade.php

        <td> {{$data->candidature->demande}} </td>

        <td> {{$data->candidature->service->nom_service}} </td>

        <td> {{$data->nom}} </td>


Solution 1:[1]

If service is indeed an array as said in the comments, try the following:

@foreach ($data->candidature->service as $service)
    <td> {{$service->nom_service}} </td>
@endforeach

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 John Zwarthoed