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

Created at 25-Apr-2022 , By samarjeet kumar

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

We will use programming in this lesson to attempt to solve the "Call to undefined method Illuminate\Database\Eloquent\Relations\HasMany::withTimestamps()".

  • 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');
    

Back to code snippet queries related laravel

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Buy Me A Coffee

Don't forget to share this article! Help us spread the word by clicking the share button below.

We appreciate your support and are committed to providing you valuable and informative content.

We are thankful for your never ending support.