Test-Eloquent-Relationships
Test-Eloquent-Relationships copied to clipboard
Test-Eloquent-Relationship
Completed Test for Eloquent Relationship. But took more than 2 hours to complete Have doubt below task
In the route /users/{user}, the table should load the comments that are written on the task that belong to a user. Define the relationship from User to Comment in the User model, so that the Blade file users/show.blade.php would work.
Test method test_show_users_comments().
got error like
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'tasks.user_id' in 'field list' (Connection: mysql, SQL: select comments
.*, tasks
.user_id
as laravel_through_key
from comments
inner join tasks
on tasks
.id
= comments
.task_id
where tasks
.user_id
in (1))
Please can you help me Thanks