Added: Caching of settings (#6378)

* Fixed missing oauth tables during setup.

* Cache settings

Cache the setting to reduce unnecessary database calls
This commit is contained in:
Wes Hulette
2018-11-01 22:59:50 -04:00
committed by snipe
parent 0730685c29
commit 88b1da4260
13 changed files with 316 additions and 190 deletions
+9 -6
View File
@@ -1,21 +1,24 @@
<?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
* @param array $parameters
* @param string $field
*
* @return string
*/
protected function prepareUniqueSerialRule($parameters, $field)
{
if ($settings = \App\Models\Setting::first()) {
if ($settings->unique_serial=='1') {
return 'unique_undeleted:'.$this->table.','. $this->getKey();
if ($settings = Setting::getSettings()) {
if ($settings->unique_serial == '1') {
return 'unique_undeleted:'.$this->table.','.$this->getKey();
}
}
}