Model Required Fields #232
Closed
WatheqAlshowaiter
started this conversation in
Package Suggestions
Replies: 1 comment
-
Thanks for the suggestion 😊 I've added the package! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
With Model Required Fields package, you can get the required model fields, excluding primary keys, nullable fields, and fields with defaults.
I first needed this information while working on a large project with no tests or factories and many migrations. It was distracting to manually look for each required field.
I created a simple trait to fetch required fields. It was easy in Laravel 11 and 10. Then I realized that most programmers who face this problem are usually using older versions, so I added support for Laravel 9, 8, 7, and 6, and extracted the logic into a package.
I tested the code for each supported Laravel version and each SQL database: SQLite, MySQL, MariaDB, PostgreSQL, and Microsoft SQL Server. I needed to add support for each SQL database because I used the DB facade with raw SQL queries, and there were slight differences each time.
The package is fully tested with PHPUnit and GitHub Actions for every Laravel version and for each database.
The usage and examples are in the readme file.
I hope you like this package, and I welcome any contributions or comments.
package link:
https://github.com/watheqAlshowaiter/model-required-fields.
Beta Was this translation helpful? Give feedback.
All reactions