Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Suggestion] use a trait instead? #1

Closed
OwenMelbz opened this issue Apr 13, 2020 · 2 comments
Closed

[Suggestion] use a trait instead? #1

OwenMelbz opened this issue Apr 13, 2020 · 2 comments
Assignees

Comments

@OwenMelbz
Copy link

OwenMelbz commented Apr 13, 2020

Hi,

Noticed your package and liked the idea, but then I saw that we must extend your base class.

This is a bit annoying for a couple of reasons, as it takes us away from the vanilla Laravel, it also makes it harder for PHP upgrades due to method signature changes using type hints, makes the default Laravel make:model command more complicated.

Instead it would be nicer just to apply the trait so people can clearly see, e.g.

class Person extends Model
{
    use Chronos;
}

Another argument that is going around is “composition over inheritance” which suggests applying functionality as needed via traits and constructors rather than having big base classes that things all extend from.

Hopefully this will be something you’d consider! Maybe even make it an option to either extend OR trait!?

Thanks :)

@cino cino self-assigned this Apr 13, 2020
@cino
Copy link
Owner

cino commented Apr 13, 2020

Hi Owen,

First of all thanks for taking the time and checking out this repo, much appreciated!

All I can say is I agree with what your saying and will be adding support for using a trait instead of extending :)

@cino
Copy link
Owner

cino commented Apr 14, 2020

This feature has been added in v1.1.0, thanks again for the feedback!

@cino cino closed this as completed Apr 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants