Call to a member function update() on null

Posted 4 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.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.