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

Answers 1
  • Solution for error Call to undefined method Illuminate\Database\Eloquent\Relations\HasMany::withTimestamps()

    --PATH app\Models\Post.php
    return $this->hasMany('App\Models\Post', 'user_id', 'id')->withTimestamps();  
    //Remove ->withTimestamps() from code 
    return $this->hasMany('App\Models\Post', 'user_id', 'id');
    
    2
  • Back to code snippet queries related laravel