I want in Laravel to "pluck" to the view names of roles, each in different badge.
My code:
<td><span class="badge badge-secondary">{{ $user->roles()->pluck('name')->implode(' ') }}</span></td>
My result:
I am getting all role names in one span class.
what about this:
<td>
@foreach($user->roles()->pluck('name') as $role_name){
<span class="badge badge-secondary">{{ $role_name }}</span>
@endforeach
</td>