Support the ongoing development of Laravel.io →
Configuration Blade
Last updated 1 year ago.
0

And all your files, including vendor files are indexed/downloaded? The ide-helper should recognize model methods, and when you run the ide-helper:models command, it should also add properties from the database etc. Not sure about Blade syntax, don't think that is fully supported.

Last updated 1 year ago.
0

Hi - yes...well I think so. I'm developing on a local machine and have this folder open as a project in phpstorm.

It looks as if the models have updated with all the comments as expected. I re-ran the ide-helper (once I created the model comments) to regenerate the help file but no impact. For example if I get a method not found with a user model on code such as $user->name where $user is a model

I'm new to phpstorm - is there another step I should take to get it to reindex/parse the help file and vendor files?

Thanks for your help

Last updated 1 year ago.
0

Allegedly, the 8.0 version of PhpStorm (which is in Beta) will include Blade syntax. I haven't tried it, so I don't know how extensive it is.

As far as model properties are concerned, you're right.. they're dynamic accessors and won't be immediately recognized by PhpStorm (you'll see "Field accessed by magic method" in the tooltip). If you like, you could set hints such as @property annotations to your model. Of course, you'll also have to @var hint the resulting variables from facades like User::find() to resolve the actual model for those annotations to work.
As you can see, that can get tedious - I never use them, personally. How often do you not actually know the properties of your model?

Don't let that small issue steer you away from PhpStorm. There are a ton of reasons why you should use it, and why it will speed up your Laravel development. Laracasts has a whole series on How to Be Awesome in PhpStorm, which is well worth the review if you truly want to give an honest shot to this IDE.

Last updated 1 year ago.
0

Hi - thanks for the advice - I want to give it a fair try and will....

On the models I think I've resolved the properties, that works now but the one area in the model that doesn't and remains as a method not found is relationships.

For example I have this relationship:

/**
 * description creates Eloquent one to many relationship
 * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
 */
public function contactForms()
{
    return $this->belongsToMany('contactForm');
}

in the header of the model I have this comment (created by ide helper)

 * @property-read \Illuminate\Database\Eloquent\Collection|\contactForm[] $contactForms

I can ignore the warnings but it's a bit frustrating to have so many yellow warnings in a controller to the point if I ignore them I'll probably miss the error that counts. (can you tell phpstorm to ignore a particular error/warning?) {possibly found it under settings]

Thanks

Last updated 1 year ago.
0

If you don't like the magic methods warning you can switch it off. You can find the checkbox under

Configure inspections > PHP > Undefined > Undefined field > Notify about access to a field via magic method

If you have to list them explicitly, they are not that magic anymore :)

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.