Skip to content

Instantly share code, notes, and snippets.

@ken-master
Created November 7, 2015 00:19
Show Gist options
  • Save ken-master/0b34013efdf9b41e365b to your computer and use it in GitHub Desktop.
Save ken-master/0b34013efdf9b41e365b to your computer and use it in GitHub Desktop.
[laravel] Traversing route name
<?php
$array = array(
'index.index','index.create','index.update','index.delete','role.index','role.create','role.update','role.delete'
);
$route_name = array('index','role');
foreach( $route_name as $value ){
foreach( $array as $v ){
if( strpos($v,$value.".") !== false ){
$arr[] = $v;
}
}
$x[$value] = $arr;
unset($arr);
}
echo "<pre>";
print_r($x);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment