mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-27 14:39:49 -08:00
88b1da4260
* Fixed missing oauth tables during setup. * Cache settings Cache the setting to reduce unnecessary database calls
26 lines
556 B
PHP
26 lines
556 B
PHP
<?php
|
|
|
|
namespace App\Http\Traits;
|
|
|
|
use App\Models\Setting;
|
|
|
|
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)
|
|
{
|
|
if ($settings = Setting::getSettings()) {
|
|
if ($settings->unique_serial == '1') {
|
|
return 'unique_undeleted:'.$this->table.','.$this->getKey();
|
|
}
|
|
}
|
|
}
|
|
}
|