protected function getForeignRoutes(Model $model, array $filter = null)
    {
        $routes = [];

        $foreigns = $model::FOREIGN_KEYS;
        if (!empty($filter)) {
            $foreigns = Utils::arrayWhitelist($foreigns, $filter);
        }

        foreach ($foreigns as $column => $fk) {
            foreach ($this->resources as $resource_name => $resource_data) {
                if ($resource_data['model'] === $fk[0]) {
                    $foreign = $model->$column;
                    if ($foreign !== null) {
                        $routes[$column] = "/$resource_name/"
                            . $this->getPrimaryKey($foreign);
                    }
                    break;
                }
            }
        }

        return $routes;
    }
protected function getForeignRoutes(Model $model, array $filter = null)
    {
        $routes = [];

        $foreigns = $model::FOREIGN_KEYS;
        if (!empty($filter)) {
            $foreigns = Utils::arrayWhitelist($foreigns, $filter);
        }

        foreach ($foreigns as $column => $fk) {
            foreach ($this->resources as $resource_name => $resource_data) {
                if ($resource_data['model'] === $fk[0]) {
                    $foreign = $model->$column;
                    if ($foreign !== null) {
                        $routes[$column] = "/$resource_name/"
                            . $this->getPrimaryKey($foreign);
                    }
                    break;
                }
            }
        }

        return $routes;
    }
protected function getForeignRoutes ( Model $ model , array $ filter = null ) { $ routes = [ ] ; $ foreigns = $ model :: FOREIGN_KEYS ; if ( ! empty ( $ filter ) ) { $ foreigns = Utils :: arrayWhitelist ( $ foreigns , $ filter ) ; } foreach ( $ foreigns as $ column => $ fk ) { foreach ( $ this -> resources as $ resource_name => $ resource_data ) { if ( $ resource_data [ 'model' ] === $ fk [ 0 ] ) { $ foreign = $ model -> $ column ; if ( $ foreign !== null ) { $ routes [ $ column ] = "/$resource_name/" . $ this -> getPrimaryKey ( $ foreign ) ; } break ; } } } return $ routes ; }
Returns list of routes to Model's Foreigns

@param Model    $model  Model whose Foreigns' routes will be returned
@param string[] $filter Only returns routes for foreigns listed here
Invalid columns are silently ignored

@return string[]
Returns list of routes to Model s Foreigns