Eloquent Method Does Not Exist

Posted 1 month ago by boldstar

So I am trying to call a method from my eloquent model however it tells me it doesn't exist. Looking to see if some body could tell me what I am doing wrong.

the issue is with the mehtod statuses()

here is the controller

public function updateWorkflowStatuses(Request $request)
        // validate form data
        $validated = $request->validate([
            'id' => 'required|integer',
            'statuses' => 'required|array',

        $workflow = Workflow::where('id', $validated['id'])->get();

        $statuses = $validated['statuses'];

        $workflow->statuses()->whereIn('workflow_id', $validated['id'])->delete();
        foreach($statuses as $status){
                'status' => $statuses['status'],
                'order' => $statuses['order']

        return response('Update Succesful', 200);


here is the model

class Workflow extends Model
    protected $fillable = [

    public function statuses()
        return $this->hasMany('App\Status');

    public function engagements()
        return $this->hasMany('App\Engagement');

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


Reply to

Use Markdown with GitHub-flavored code blocks.