mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-26 06:04:08 -08:00
24 lines
505 B
PHP
24 lines
505 B
PHP
|
<?php
|
||
|
namespace App\Http\Traits;
|
||
|
|
||
|
trait UniqueSerialTrait
|
||
|
{
|
||
|
|
||
|
/**
|
||
|
* Prepare a unique_ids rule, adding a model identifier if required.
|
||
|
*
|
||
|
* @param array $parameters
|
||
|
* @param string $field
|
||
|
* @return string
|
||
|
*/
|
||
|
protected function prepareUniqueSerialRule($parameters, $field)
|
||
|
{
|
||
|
$settings = \App\Models\Setting::first();
|
||
|
|
||
|
if ($settings->unique_serial=='1') {
|
||
|
return 'unique_undeleted:'.$this->table.','. $this->getKey();
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|