Skip to content

docs: there is no Hash::make method #187

Open
@taai

Description

@taai

Hi,

I'm fallowing the documentation about attribute hydration and found out that either there is a bug (the method does not exist) or the documentation is wrong.

In docs there is this code example:

Hash::make('coordinates')->fillUsing(
  static function ($model, $column, $value, array $validatedData) {
    $model->fill([
      "{$column}_longitude" = $value['long'],
      "{$column}_latitude" = $value['lat'],
    ]);
  }
);

In documentation it is not specified what namespace the class Hash is in and the only class I found with that name was LaravelJsonApi\Core\Json\Hash. It didn't work, the method make is undefined.

Somehow, while writing this issue, I found the class LaravelJsonApi\Eloquent\Fields\ArrayHash and tried that instead - it worked.

Please fix the documentation, replace Hash::make with ArrayHash::make (if I'm right about this).

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions