File Manager Lite
Dir:
/home/codewavebd/public_html/vendor/laravel/framework/src/Illuminate/Validation/Rules
Upload
[..]
AnyOf.php (2.15 KB)
Edit
Rename
Del
Can.php (1.8 KB)
Edit
Rename
Del
Contains.php (1.04 KB)
Edit
Rename
Del
Dimensions.php (3.15 KB)
Edit
Rename
Del
DoesntContain.php (1.06 KB)
Edit
Rename
Del
Email.php (6.64 KB)
Edit
Rename
Del
Enum.php (4.02 KB)
Edit
Rename
Del
ExcludeIf.php (1.06 KB)
Edit
Rename
Del
ExcludeUnless.php (1.06 KB)
Edit
Rename
Del
In.php (1.18 KB)
Edit
Rename
Del
NotIn.php (1.12 KB)
Edit
Rename
Del
Password.php (11.02 KB)
Edit
Rename
Del
ProhibitedIf.php (1.07 KB)
Edit
Rename
Del
ProhibitedUnless.php (1.08 KB)
Edit
Rename
Del
RequiredUnless.php (1.15 KB)
Edit
Rename
Del
Unique.php (1.62 KB)
Edit
Rename
Del
Edit: 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() ), ','); } }
Simpan