0

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);
}
Khalil Ghanem
  • 166
  • 13

0 Answers0