6 days ago

Call to undefined method Carbon\Traits\Week::where() error, why?

Posted 6 days ago by haritz

I am getting this error and honeslty I have no idea why this is happening.

Getting this error here:

 $week_active = Weeks::where('active', 1)->first();

        $match = Match::where('WEEK' , $week_active->name)->first();

        $date = Carbon::parse($match->date);
        if($date <= Carbon::now()){
            Week::where('active', 1)->first()->update(['active' => 0]); //Getting error here
            Week::where('id', '>', $week_active->id)->first()->update(['active' => 1]);

I just want to update a row. $match->date is returning a datetime.

Thank you.

Please sign in or create an account to participate in this conversation.