mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-17 19:14:06 -08:00
26 lines
657 B
PHP
26 lines
657 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Http\Traits;
|
||
|
|
||
|
trait TwoColumnUniqueUndeletedTrait
|
||
|
{
|
||
|
/**
|
||
|
* Prepare a unique_ids rule, adding a model identifier if required.
|
||
|
*
|
||
|
* @param array $parameters
|
||
|
* @param string $field
|
||
|
* @return string
|
||
|
*/
|
||
|
protected function prepareTwoColumnUniqueUndeletedRule($parameters, $field)
|
||
|
{
|
||
|
$column = $parameters[0];
|
||
|
$value = $this->{$parameters[0]};
|
||
|
|
||
|
if ($this->exists) {
|
||
|
return 'two_column_unique_undeleted:'.$this->table.','.$this->getKey().','.$column.','.$value;
|
||
|
}
|
||
|
|
||
|
return 'two_column_unique_undeleted:'.$this->table.',0,'.$column.','.$value;
|
||
|
}
|
||
|
}
|