Class User extends Model {
public function posts()
{
return $this->hasMany(Post::class);
}
}
$user = User::fetchSomeUser();
$post = Post::createSomeNewPost();
var_dump($user->posts); // Gives me all the posts which where attached to the user BEFORE i loaded the model from the DB
$user->posts()->attach($post); // or save?
var_dump($user->posts); // Is still the same as above. The new attached post is not fetched by this dynamic property. Is there a way to get the new post into this dynamic property WITHOUT reloading the hole data from the DB?