how to call trait function in laravel code example
Example 1: laravel make trait command
php artisan make:trait nameOfTheTrait
Example 2: php override trait method and call it
trait A {
function calc($v) {
return $v+1;
}
}
class MyClass {
use A {
calc as protected traitcalc;
}
function calc($v) {
$v++;
return $this->traitcalc($v);
}
}