Comments (6)
That looks useful indeed. Will see when I have some extra time.
Of you want you can also submit a PR.
from laravel-ide-helper.
Pushed an update, does this work for you?
from laravel-ide-helper.
It almost does, although instead of just marking the return type as \WhateverModel
it should probably be \Illuminate\Database\Query\Builder|\WhateverModel
otherwise using e.g.
\WhateverModel::whereName('admin')->first()
ends up marking first()
as an undefined method.
from laravel-ide-helper.
But doesnt eloquent already extend that class? (in the helper at least)
from laravel-ide-helper.
For me, User::whereEmail('..') returns an User instance. User extends Eloquent (the facade) and the ide_helper.php adds the first() etc methods to Eloquent.
Did you also generate the ide helper file? And do you extend Eloquent, or Illuminate\Database\Eloquent\Model? Only extending Eloquent works with the helper, not the Model class directly.
from laravel-ide-helper.
You are correct it does, but for users like (for now) myself who use packages like ardent our models extend PackageModelX which extends Eloquent, but because PackageModelX is a package model the ide-helper does not know about those, hence the chain gets broken, which is why adding \Illuminate\Database\Query\Builder
fixes it for me!
from laravel-ide-helper.
Related Issues (20)
- Incorrect type for nullable morph HOT 3
- Two blank docblock lines in model HOT 1
- Thread docs bloks as primary source of type
- Nullable timestamps HOT 5
- Defining database in $table no longer works? HOT 2
- Support for casts AsEnumCollection HOT 3
- php artisan ide-helper:meta throws error PHP Warning: Trying to access array offset on value of type null HOT 2
- Expected type 'iterable'. Found 'Illuminate\Database\Query\iterable'. HOT 3
- newQuery and newModelQuery are not static methods
- MySqlGrammar: : compileColumns function for mariadb and mysql information_schema. The columns structure difference is an error HOT 1
- Json mysql column is translated as mixed instead of string
- As a Developer working on Windows I want the Line-Endings inside the generated PHP Doc to be CRLF HOT 3
- Exception: Method MongoDB\Laravel\Schema\Grammar::compileColumns does not exist. HOT 1
- Macro on HttpClient does not return correct Return statement
- Make model factory method annotation optional in phpDoc HOT 1
- Issues after Laravel 11.15 HOT 3
- Method "only" does not exist on class "Illuminate\Http\Request"
- Get type of model when using Eloquent with methods from Query\Builder
- Is this a bug...? Is this a dream...? HOT 2
- Error preg_replace(): Argument #3 ($subject) must be of type array|string, false given
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-ide-helper.