Reputation: 1437
So i have a trait, let's name it TraitTwo
It looks like this:
<?php
namespace App\Traits;
use App\Models\Using1;
use App\Models\Using2;
trait TraitTwo
{
public function MyFuncTwo() {
code..
code..
}
}
I want to use this trait in another trait, let's name this one TraitOne
It looks like this:
<?php
namespace App\Traits;
use App;
use App\Models\UsingOne;
use App\Models\UsingTwo;
use App\Models\UsingThree;
use App\Models\UsingFour;
use Illuminate\Support\Facades\UsingFive;
use UsingSix;
use UsingSeven;
trait TraitOne
{
use TraitTwo;
public function MyFuncOne() {
TraitTwo::MyFuncTwo();
}
}
Except this is not working, I keep getting the following error:
Trait 'App\Traits\TraitTwo' not found
Upvotes: -1
Views: 2217
Reputation: 10714
You should reset composer cache after creating a Trait, in your console :
composer dump-autoload
Then, try again
Upvotes: 1