0

I have a function in the MissingData model, that is called from the MissingDataController:

public function store(Request $request)
    {
    $missingData = MissingData::where('operation_id', 1)->firstOrFail();
    $missingData->fillData();
}

Code works great, but PhpStorm cannot open fillData() when using Ctrl + B. In general, this happens when $missingData is not a MissingData model. But here, when I dd($missingData), it returns a App\Models\MissingData instance.

I also tried to invalidate PhpStorm Cache, but it didn't work.

Why is it happening ? For all other methods, PhpStorm works fine.

4
  • stackoverflow.com/questions/42160204/… Commented Apr 12, 2021 at 14:18
  • I already use laravel-ide-helper ! I will update my question with that Commented Apr 12, 2021 at 14:22
  • Did you regenerate it after adding your new method? Commented Apr 12, 2021 at 14:23
  • yep, I just did it again, and it didn t work Commented Apr 12, 2021 at 14:24

1 Answer 1

1

I would assume that PHPStorm doesn't know that result of firstOrFail() is of type App\Models\MissingData. To solve that I would simply add phpdoc:

/** @var \App\Models\MissingData $missingData */
$missingData = MissingData::where('operation_id', 1)->firstOrFail();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.