cause I sure has hell just made a kickass logging trait. Alone I don’t think I could have wrote this straight up as quickly as I did with TDD. Plus, now it is testable for the life of the project. Why the hell haven’t I been doing this all along?!
Here’s a bit of code fo yo ass. Here’s the migration for the logs table:
And here the model. Nothing special.
Here is the trait that evolved thanks to TDD
And here is the implementation of that trait
Pretty neat, huh? Here is the test class that brought this Logging feature about.
Am I doing this right? I have no idea. What I do know is that I started out needing the ability to log and now I have a trait I can slap on any model to store logs on. Back in the day I would have extended a class to take on this functionality but this is so much better.
Imma keep at it. This was a great start.