I try to use trait in laravel blade, but didn't work.
This is trait
namespace App\Repositories;
trait Residence
{
public $country=['USA','Japan','Italy'];
public $building=['duplex','condominium'];
}
I try to use in my blade like this:
@inject('Residence', 'App\Repositories\Residence')
@foreach($Residence->country as $country)
{{$country}}
@endforeach
@foreach($Residence->building as $building)
{{$building}}
@endforeach
But I get Target [App\Repositories\Residence] is not instantiable. error, any suggestion?(I'm using laravel 5.7)