Skip to content

Connections specific configuration's examples issues #217

@tigerbook73

Description

@tigerbook73

in config/models.php:

there are following code:

  // 'connections' => [
  //   'read_only_external' => [
  //     'parent' => \App\Models\ReadOnlyModel::class,
  //     'connection' => true,
  //     'users' => [
  //       'connection' => false,
  //     ],
  //     'my_other_database' => [
  //       'password_resets' => [
  //         'connection' => false,
  //       ]
  //     ]
  //   ],

I believe the examples is not correct. the 'connections' shall be '@connections' according to the source code in src/Coders/Model/Config.php:

    public function get(Blueprint $blueprint, $key, $default = null)
    {
        $priorityKeys = [
            "@connections.{$blueprint->connection()}.{$blueprint->table()}.$key",
            "@connections.{$blueprint->connection()}.{$blueprint->schema()}.$key",
            "@connections.{$blueprint->connection()}.$key",
            "{$blueprint->qualifiedTable()}.$key",
            "{$blueprint->schema()}.$key",
            "*.$key",
        ];

        foreach ($priorityKeys as $key) {
            $value = Arr::get($this->config, $key);

            if (!is_null($value)) {
                return $value;
            }
        }

        return $default;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions