4 years ago

hasMany undefined property

Posted 4 years ago by netcore

Hello. I have problem in my code.

Table structure



This is code method on Category model -

This is code in controller -

$category = Category::all()->articles;
return dd($category);

After return I get this ErrorException in ArticlesController.php line 108: Undefined property: Illuminate\Database\Eloquent\Collection::$articles

What is wrong there? Please help me

Please sign in or create an account to participate in this conversation.