spatie / laravel-enum

Laravel support for spatie/enum
https://spatie.be/open-source
MIT License
344 stars 37 forks source link

Adds an example Enum class to the readme #55

Closed xewl closed 4 years ago

xewl commented 4 years ago

As it wasn't very/directly apparent from the readme to extend from the actual Enum class made for Laravel [imho]; this PR adds an example Enum class based on the existing StatusEnum example being used, and a link to the documentation of spatie/enum.

@Gummibeer - I'm not that familiar with putting this all in the correct wording... guide me senpai 😁

closes #53

brendt commented 4 years ago

The first thing the README does is link to spatie/enum. I'd expect the users of this package to know the base package it's built upon.

On the other hand, there's no harm in adding this to the README I suppose, if it's unclear for some.

Gummibeer commented 4 years ago

There's a slight difference - the different base classes. That's what this PR is primary about.

xewl commented 4 years ago

The first thing the README does is link to spatie/enum. I'd expect the users of this package to know the base package it's built upon.

There's a slight difference - the different base classes.

Well, that answered itself. But yes, the main aim for this PR is to make clear that there's a difference. I was migrating code to v2, while still using the original use statement. Because I didn't make a new Enum class, I didn't really notice the difference from either:

The documentation for spatie/enum of course just uses the initial class too.

The example is to give readers a glance of which actual use statement to use, and the notice below it does repeat the link to the actual documentation. The latter, I'm pretty sure, can't hurt to note though..

Edit: Another idea would be to add a notice/page on the original package's documentation, for the Laravel users as there's no actual separate documentation for this repo, to direct people to extend on the correct class.

I'm willing to change this to whatever you guys think is best, this is just my take.

Gummibeer commented 4 years ago

So, now I have some time to handle this. I've added a simple docs page to the base package about the Laravel wrapper: https://github.com/spatie/enum/commit/7e2156adef41c7ae9fcd60ad4de26eeec45c9518

On top I will merge this and slim it a bit down and highlight the important line in favor of what Brent said that most of this is the same as in the base package and you should know how the base package works before implementing the advanced laravel features.