I haven't used laravel yet, but watching the tutorials on youtube left me with a question to type hinting, that is really important to me.
Now I have read here
Type Hinting Eloquent Models
and here
Eloquent ORM Code Hinting in PhpStorm
but neither addresses the following problem:
namespace App;
use Illuminate\Database\Eloquent\Model;
class Movie extends Model {
}
now lets say movie has a name, id, length, author
all those fields are not defined in the class movie, but somehow come automagically from the active record ORM eloquent model if I understood correctly
But let's be honest, I wont remember if it was called author
, Author
or AuthorName
. Or MovieLength
, Length
or TotalTime
how should i remember all of that for ALL models? is there a way to type hint this in php storm?
i mean the fields from all tables in all models.
EDIT
to make it more clear
i want to type:
$m = App\Movie::find(1);
$m->|
where |
is my caret. Now what fields do I have on the class Movie?
Your best bet would be to install the laravel-ide-helper ServiceProvider package in your application
https://github.com/barryvdh/laravel-ide-helper
Seems to have a lot of helpful features for type hinting to the IDE.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With