NeoZeroSeer

BadMethodCallException: Call to undefined method Illuminate\Database\Eloquent\Relations\HasMany::associate()

laravel Icon

BadMethodCallException

Call to undefined method Illuminate\Database\Eloquent\Relations\HasMany::associate()

An unhandled exception occurred on line 50
47
     */
48
    protected static function throwBadMethodCallException($method)
49
    {
50
        throw new BadMethodCallException(sprintf(
51
            'Call to undefined method %s::%s()', static::class, $method
52
        ));

Solution

Changed in the model from HasMany to belongsTo            
Apr 10, 2021 Anyone

0 replies


Install the browser extension

Found this solution helpful? Try our extension for quick solutions to your Laravel errors.

Chrome logo Add to Chrome - It's free