For whatever reason if you want to use both traits at the same time then you can use the "as" keyword. For eg. class MyClass{ use traitOne, traitTwo{ traitOne::message insteadof traitTwo; traitTwo::message as traitTwoMessage; } } $c = new MyClass(); $c->message(); //will output "one" $c->traitTwoMessage(); //will output "two" Traits can also be imported as private/protected. Traits have so many features than I had imagined. Its amazing
You are doing great work brother. How we can pass User Object to trait boot method. when boot method auto call. Got my question brother. If not then let me know then i will share repo link with you.
For whatever reason if you want to use both traits at the same time then you can use the "as" keyword. For eg.
class MyClass{
use traitOne, traitTwo{
traitOne::message insteadof traitTwo;
traitTwo::message as traitTwoMessage;
}
}
$c = new MyClass();
$c->message(); //will output "one"
$c->traitTwoMessage(); //will output "two"
Traits can also be imported as private/protected. Traits have so many features than I had imagined. Its amazing
Yes, This is regularly we followed.
Wow, that's awesome.
helpful one
ty 🙏🏼
Thanks for sharing knowledge ☺
Keep watching
Learned new thing here, Thanks :)
You are welcome
You are doing great work brother. How we can pass User Object to trait boot method. when boot method auto call. Got my question brother. If not then let me know then i will share repo link with you.
I don't think you can pass any params to the boot method
what editor are you using?