How would you be supplying this category variable in the view? Please explain what you are trying to accomplish functionally. Like, I want to have the user change a select box and have it show the selected category results. Explain it in regular terms, not code.
From your other posts it seems like get an idea on how to solve a problem and start heading down the path you think is correct and ask for help about the path because you run into issues, but the path is wrong to begin with and can be solved a different way. So please take some time and explain what you are wanting to have the app do.
@foreach($category_with_projects as $category)
{{ $category->name }}
@foreach($category->projects as $project)
// ALL CATEGORY PROJECTS
@endforeach
@endforeach
Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'projects.project_has_categories' in 'where clause' (SQL: select * from projects where projects.project_has_categories in ())