All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Laravel 9 support.
- Version 2.0.0 released.
- The
Presenterclass now has atoArray()method which will return ALL presentables as an array (including hidden presentables).
- Model classes can now specify presentable classes by passing the attribute name and the class path to the
$presentablesarray attribute. - If the class cannot be found, a new
InvalidPresentableClassexception will be thrown. - Added the ability to hide presenters from the array by implementing the
IsHiddeninterface. - Added the presenter options. Options can be passed to presenter classes by passing an array to each item in the
$presentablesarray. - Added the ability for presenter classes to have access to the attribute from the
$presentablesarray. - Default presentables can be added to the
presentableconfig file and will be added to allIsPresentableclasses.
- The signature for the
Presenterclass has been changed. The firstModelparameter has been removed as it was never actually used. - The
IsPresentabletrait has been updated to reflect the above change. - This is a potential breaking change if the
Presenterclass is overridden.
- Included a configuration file. The default array key (
presentable) can now be configured. - Some simplification in the
IsPresentabletrait. - Protected method
getBaseAttrinbuteshas been renamed togetOriginalAttributes.
- Renamed the
present()topresentable()so that it now matches the key name when converting the model to an array. - Added
getBaseAttributes()method to theIsPresentabletrait which will now test for the existence of atoArraymethod on the parent class before trying to callparent::toArray(). This might allow for the use ofIsPresentableoutside of Laravel projects (not tested). - Updated the
toArraymethod onIsPresentableto get an array of attributes from thegetBaseAttributesmethod.