<?php

namespace Lightscale\LaralightTables\Concerns;

use Illuminate\View\ComponentAttributeBag;

trait WithAttributes
{
    protected ?array $attributes = null;

    public function attributes(array $attributes): static
    {
        $this->attributes = $attributes;
        return $this;
    }

    protected function getAttributes(): ComponentAttributeBag
    {
        return new ComponentAttributeBag($this->attributes ?? []);
    }

}