Call to a member function update() on null

Posted 8 months ago by irankhosravi

What is this error?

Call to a member function update() on null

RequisitionController.php

public function update(Request $request, SubmitApplication $submitApplication)
{
    $submitApplication = SubmitApplication::find($request['id'])->update(['approved', 1]);
    return redirect()->back();
}

SubmitApplication.php

class SubmitApplication extends Model
{
    public function school_lists()
    {
        return $this->belongsTo(SchoolsList::class);
    }

    public function requisition()
    {
        return $this->hasMany(Requisition::class);
    }
}

I want to update approved form 0 to 1.

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

Reply to

Use Markdown with GitHub-flavored code blocks.