Skip to content

Releases: tpg/is-presentable

v2.0.1

26 Jan 18:57
Compare
Choose a tag to compare

Laravel > 8 support.

v2.0.0

02 Jan 13:37
Compare
Choose a tag to compare

Version 2 brings something completely new. Presentables can now be defined as classes to make the more reusable. The old way (as in the presentable accessor methods) still works fine and there is no intention of removing that feature. This version is backward compatible, but if you encounter any problems please log an issue.

There are a number of changes which could cause problems if you're extended IsPresentable. The only one I can think of that may cause some frustration is the protected array that stored presentables on your models has been renamed from $presenters to $presentables.

I've also fleshed out the readme a lot for this version so there's plenty of detail on how to use IsPresentable.

v2.0.0-beta.3

23 Dec 12:26
18e0a8c
Compare
Choose a tag to compare
v2.0.0-beta.3 Pre-release
Pre-release

Added a toArray() method to the Presenter class. This can be used like this:

$presentables = $user->presentable()->toArray();

v2.0.0-beta.1

14 Dec 21:36
Compare
Choose a tag to compare
v2.0.0-beta.1 Pre-release
Pre-release

Version 2 brings a new way to create presentables with a lot of flexibility and less duplication.

I've tried to keep as much backward compatibility as possible, so version 1 users should be able to upgrade without making any changes to their code. If you're overriding stuff, then there might be some things that are going to break.

Version 2 introduces a number of new features:

  • Presentable classes are a handy way to allow for the reuse of presentables.
  • Pass arbitrary data into presentable classes so you could have a single class that can be used to present different attributes.
  • Default presentables can be set in the configuration file.
  • Presentable classes can be marked as hidden which will remove them from the array when using toArray on a model.

v1.1.0

06 Jul 10:45
Compare
Choose a tag to compare

Made a change to the Presenter class that removes the requirement of a Laravel Model class. This should help make the package a little less "Laravel Model specific".

v1.0.0

22 May 15:01
Compare
Choose a tag to compare

Version 1! Yeah!

Okay, it's not that amazing. Is-presentable is fairly basic. It probably should have been tagged ages ago. Anyway.

Added the ability to configure the key used when casting the model as an array.

v0.2.0

25 Mar 09:08
e51cbc1
Compare
Choose a tag to compare
  • Renamed the present() method on the IsPresentable trait to presentable() so that its the same name as the presentable key on the array when calling toArray().
  • Potentially the library could work outside of a Laravel project. The toArray() method has an update that will now check for the existence of a toArray() method on the parent first. You could override the getBaseAttributes() method as well to return whatever attributes your model needs to return.

v0.1.0

08 Mar 21:50
Compare
Choose a tag to compare

There's not much to this thing. It's really just a packaged version of something I've been doing for a while now. Just to make it simply to include in other projects.
If there's any new ideas for this, I'm keen to hear them.