Laravel-ide-helper: Errorhandling with laravel V3 models "Cannot redeclare non static..."

Created on 26 Dec 2013  路  3Comments  路  Source: barryvdh/laravel-ide-helper

Hi,

this is only an enhancement, not a real issue. As I'm upgrading my laravel framework from V3 to V4, Iinstalled your very handy tools (thank you for them) and ran into this issue: With Eloquent models V3 you have to declare the table property as public static, now with V4 as protected. If you are not aware of this, php artisan ide-helper:models your-model leads to a 'nice' PHP Fatal error: Cannot redeclare non static Illuminate\Database\Eloquent\Model::$table as static Your-model::$table in ....
Maybe you could add a warning in your readme. And if not, from now on everybody else will know how to solve the error by themselfs :-)

Happy coding

Most helpful comment

change public static by protected

All 3 comments

But wouldn't it throw an error anyways when you first try to you use your model? So not really an issue with the command..

Yes, your right. After looking at the stack trace I saw, that it's laravel throwing the exception, not your code.

change public static by protected

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hatamiarash7 picture hatamiarash7  路  3Comments

neeravp picture neeravp  路  3Comments

GitzJoey picture GitzJoey  路  4Comments

andrew-svirin picture andrew-svirin  路  4Comments

ivansammartino picture ivansammartino  路  3Comments