The true traits for AdonisJS Framework (extending the class with native
extendfunction)
🏠 Homepage
adonis install @mikield/adonis-true-traitsMake sure you register the provider inside start/app.js file before making use.
const providers = [
...,
'@mikield/adonis-true-traits'
]mix(SomeClass).with(SomeTrait, AnotherTrait, ...)"use strict";
const Model = use('Model')
const MyTrait = use('App/Models/Traits/MyTrait')
class User extends Model {
}
module.exports = mix(User).with(MyTrait)"use strict";
const Trait = (Model) => class extends Model {
myFunction(){
return "Hi from the Trait"
}
get myParam(){
return "The param from Trait"
}
}
module.exports = Trait;👤 Vladyslav Gaysyuk [email protected]
- Website: https://mikield.rocks
- Twitter: @AdmiralMiki
- Github: @mikield
- LinkedIn: @mikield
Contributions, issues and feature requests are welcome!
Feel free to check issues page. You can also take a look at the contributing guide.
Give a ⭐️ if this project helped you!
Copyright © 2020 Vladyslav Gaysyuk [email protected].
This project is MIT licensed.
This README was generated with ❤️ by readme-md-generator