Skip to content

Add append function #47

@mikemellor11

Description

@mikemellor11

Hi

Love the library.

How do you feel about adding the append method that is currently missing.

/**
 * Append attributes to query when building a query.
 *
 * @param  array|string  $attributes
 * @return $this
 */
public function append($attributes)
{
    $this->appends = array_unique(
        array_merge($this->appends, is_string($attributes) ? func_get_args() : $attributes)
    );

    return $this;
}

This way we can append dynamically and they'll be present when the final model is requested via toArray();

$model->append('thing');

$model->toArray(); // includes ["thing" => ....]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions