Illuminate\Routing\Router::mergeGroup PHP Method

mergeGroup() public static method

Merge the given group attributes.
public static mergeGroup ( array $new, array $old ) : array
$new array
$old array
return array
    public static function mergeGroup($new, $old)
    {
        $new['namespace'] = static::formatUsesPrefix($new, $old);
        $new['prefix'] = static::formatGroupPrefix($new, $old);
        if (isset($new['domain'])) {
            unset($old['domain']);
        }
        $new['where'] = array_merge(isset($old['where']) ? $old['where'] : [], isset($new['where']) ? $new['where'] : []);
        if (isset($old['as'])) {
            $new['as'] = $old['as'] . (isset($new['as']) ? $new['as'] : '');
        }
        return array_merge_recursive(Arr::except($old, ['namespace', 'prefix', 'where', 'as']), $new);
    }

Usage Example

Example #1
0
 public static function mergeGroup($new, $old)
 {
     $newGroup = parent::mergeGroup($new, $old);
     if (isset($old['vars'])) {
         $newGroup = array_merge($newGroup, $old['vars']);
     }
     return $newGroup;
 }
All Usage Examples Of Illuminate\Routing\Router::mergeGroup