PHP 8.3.31
Preview: Unique.php Size: 1.62 KB
/home/getspomw/royalsquad.us/vendor/laravel/framework/src/Illuminate/Validation/Rules/Unique.php

<?php

namespace Illuminate\Validation\Rules;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Traits\Conditionable;
use Stringable;

class Unique implements Stringable
{
    use Conditionable, DatabaseRule;

    /**
     * The ID that should be ignored.
     *
     * @var mixed
     */
    protected $ignore;

    /**
     * The name of the ID column.
     *
     * @var string
     */
    protected $idColumn = 'id';

    /**
     * Ignore the given ID during the unique check.
     *
     * @param  mixed  $id
     * @param  string|null  $idColumn
     * @return $this
     */
    public function ignore($id, $idColumn = null)
    {
        if ($id instanceof Model) {
            return $this->ignoreModel($id, $idColumn);
        }

        $this->ignore = $id;
        $this->idColumn = $idColumn ?? 'id';

        return $this;
    }

    /**
     * Ignore the given model during the unique check.
     *
     * @param  \Illuminate\Database\Eloquent\Model  $model
     * @param  string|null  $idColumn
     * @return $this
     */
    public function ignoreModel($model, $idColumn = null)
    {
        $this->idColumn = $idColumn ?? $model->getKeyName();
        $this->ignore = $model->{$this->idColumn};

        return $this;
    }

    /**
     * Convert the rule to a validation string.
     *
     * @return string
     */
    public function __toString()
    {
        return rtrim(sprintf('unique:%s,%s,%s,%s,%s',
            $this->table,
            $this->column,
            $this->ignore ? '"'.addslashes($this->ignore).'"' : 'NULL',
            $this->idColumn,
            $this->formatWheres()
        ), ',');
    }
}

Directory Contents

Dirs: 0 × Files: 17

Name Size Perms Modified Actions
986 B lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
1.80 KB lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
5.37 KB lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
3.24 KB lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
3.17 KB lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
6.59 KB lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
3.43 KB lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
1.06 KB lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
476 B lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
9.25 KB lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
508 B lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
1.20 KB lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
1.14 KB lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
8.59 KB lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
1.07 KB lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
999 B lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
1.62 KB lrw-rw-rw- 2025-09-17 06:52:58
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).