I've looked at other questions that have answered this same error and I understand I have a property that cannot be defined but not sure how to make it defined. First time using Many-to-Many relationship so I'm assuming this is the issue.
Project Table id company stage status date_started date_finished timestamps
Employee Table id name department timestamps
Employee_Project Table id employee_id project_id
In both models, I have belongsToMany and for the show function in the ProjectController, I have:
$projects = Project::find($id);
In the view, I want to show company name ($projects->company) and the employees on that project with their respective departments. These does not work:
$projects->employees->name $projects->employees->department
How do I access these properties?
via robk27