how to create trait and whats the benefits and use

 create folder trait

Trait nameoftrait{

}


class MyClass {

    use MyTrait;

    

    // Class methods and properties

}




multiple inheritance
use controller -> single inheritance
traits multiple inheritance
reusable of code
duplication of code removes


No comments:

Post a Comment

Event listening in react

 How we can listen to som eevents some envents fire like click or automatically user enters into input button , that is event on word type i...