Enormous class size
Hello,
Just wondering if is it me but I'm often reach 1k+ rows of code in my class (resource or page).
How to you manage / split your code to keep something clean and readable ?
Best regards,
Solution:Jump to solution
For my Resources I will often put my component definitions for Forms and Infolists into a trait that I keep in the same namespaced directory as other things for that Resource (pages, widgets, etc)
eg:
```php
public static function getProjectNameField()...
2 Replies
Solution
For my Resources I will often put my component definitions for Forms and Infolists into a trait that I keep in the same namespaced directory as other things for that Resource (pages, widgets, etc)
eg:
That way if I need to re-use it in another resource (such as something that's used in both an Admin panel and in a non-Admin panel) I can just re-use the same definition in both places. This keeps it consistent with things like validation and field-lengths that match the db, helper text, etc.
If I need to customize something about it, I can chain additional methods on it in the Resource.
Thank you, I ended up to similar approach π