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;
    }