- Use the conditionable trait in Laravel for cleaner code.
- Group and comment your migration fields for better readability.
- Use the 'withPivotValue' method for pivot tables.
- Ensure you're working with a testing database before running PHP Artisan test.
- Use the 'repeat' method for specific tests to increase the probability of passing.
- Override the randomness for strings in testing scenarios.
- Use 'setTimes' to false to update data without updating the 'updated_at' column.
- Use 'whereRelation' for a shorter syntax in nested conditions.
- Adopt the habit of selecting only what you need and using pagination.
via 9 Laravel/PHP Tips in 8 Minutes: September 2024