I have a controller that uses two traits, CavityTools
and OperationTools
class OperationController extends Controller
{
use \App\Traits\CavityTools;
use \App\Traits\OperationTools;
However, the second trait OperationTools using
CavityTools`:
trait OperationTools {
use \App\Traits\CavityTools;
So when I try to use a method of OperationTools
from any controller's method such as $this->getProduction()
, I have got an error tells about a method in the CavityTools
that it is not applied due to collision:
Trait method cavityPerformanceBetweenTimes has not been applied, because there are collisions with other trait methods on App\Http\Controllers\OperationController
I have tried to to alias the second trait, use \App\Traits\OperationTools as OpTs;
but it generate parse error:
Parse error: syntax error, unexpected 'as' (T_AS), expecting ',' or ';' or '{'
How could I solve this issue?