HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux ip-10-0-8-47 6.8.0-1021-aws #23~22.04.1-Ubuntu SMP Tue Dec 10 16:31:58 UTC 2024 aarch64
User: ubuntu (1000)
PHP: 8.1.2-1ubuntu2.22
Disabled: NONE
Upload Files
File: /var/www/admin.javaapp.co.uk/vendor/yajra/laravel-datatables-html/src/Html/Editor/Fields/Select.php
<?php

namespace Yajra\DataTables\Html\Editor\Fields;

/**
 * @see https://editor.datatables.net/reference/field/select
 */
class Select extends Field
{
    protected string $type = 'select';

    /**
     * Set field multiple value.
     *
     * @param  bool  $value
     * @return $this
     */
    public function multiple(bool $value = true): static
    {
        $this->attributes['multiple'] = $value;

        return $this;
    }

    /**
     * Set field optionsPair value.
     *
     * @param  array|string  $label
     * @param  string  $value
     * @return $this
     */
    public function optionsPair(array|string $label = 'label', string $value = 'value'): static
    {
        if (is_array($label)) {
            $this->attributes['optionsPair'] = $label;
        } else {
            $this->attributes['optionsPair'] = [
                'label' => $label,
                'value' => $value,
            ];
        }

        return $this;
    }

    /**
     * Set field placeholder value.
     *
     * @param  string  $value
     * @return $this
     */
    public function placeholder(string $value): static
    {
        $this->attributes['placeholder'] = $value;

        return $this;
    }

    /**
     * Set field placeholderDisabled value.
     *
     * @param  bool  $value
     * @return $this
     */
    public function placeholderDisabled(bool $value): static
    {
        $this->attributes['placeholderDisabled'] = $value;

        return $this;
    }

    /**
     * Set field placeholderValue value.
     *
     * @param  string  $value
     * @return $this
     */
    public function placeholderValue(string $value): static
    {
        $this->attributes['placeholderValue'] = $value;

        return $this;
    }
}