Support the ongoing development of Laravel.io →
Configuration Input
Last updated 2 years ago.
0

Hello!
You call the save method which throws the exception inside the store method of your controller. That means that Auth::user()->articles returns null. That is probably because you didn't define the relationship correctly. You are probably missing the return statement insisde the relationship definition.

class User ...
public function articles(){
 return $this->hasMany('Article');
// You are missing the return above.
}
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.