@jlrdw everything always worked as expected.. What got me questioning things was when I wanted to replace the ' , ' with a "< b r / >" and the ' , ' worked fine but the "< b r / >" wouldn't.
This is what I originally had
<span class="position mb-5"> {{ $user->roles->implode('role_name', ' , ') }}</span>
This is what I changed it to because I wanted the "< b r / >" instead of the ' , '
<span class="position mb-5"> {{ $user->roles->implode('role_name', '<br /'>) }}</span>
In my mind, the above should have worked fine, but it didn't and that's what set me on the journey to figure out why it didn't work and abandoning my plan to use this code to try a refactor.
Here is the dd()... I expanded the first one so you could see the test info, but the rest are the same, but different users.
Illuminate\Database\Eloquent\Collection {#1301 ▼
#items: array:6 [▼
0 => App\User {#1300 ▼
#fillable: array:3 [▶]
#hidden: array:2 [▶]
#casts: array:1 [▶]
#connection: "mysql"
#table: "users"
#primaryKey: "id"
#keyType: "int"
+incrementing: true
#with: []
#withCount: []
#perPage: 15
+exists: true
+wasRecentlyCreated: false
#attributes: array:9 [▼
"id" => 1
"name" => "David McGlone"
"email" => "david@localhost"
"email_verified_at" => null
"password" => ""
"img" => "me.png"
"remember_token" => null
"created_at" => "2021-07-02 20:47:37"
"updated_at" => "2021-07-02 20:47:37"
]
#original: array:9 [▶]
#changes: []
#classCastCache: []
#dates: []
#dateFormat: null
#appends: []
#dispatchesEvents: []
#observables: []
#relations: array:1 [▶]
#touches: []
+timestamps: true
#visible: []
#guarded: array:1 [▶]
#rememberTokenName: "remember_token"
}
1 => App\User {#1303 ▶}
2 => App\User {#1304 ▶}
3 => App\User {#1305 ▶}
4 => App\User {#1306 ▶}
5 => App\User {#1307 ▶}
]
}