Is there a cleaner way to perform the following simple operation? Maybe using a collection or map? Also please advise me if your approach has better performance for education purposes.
$permissions = []; // ['admin', 'user']
foreach($role->permissions as $permission){
array_push($permissions, $permission->name);
}