first(function ($item) use ($identifier) { return $item->{self::$name} == $identifier || $item->{self::$id} == $identifier; }); if (!empty($result)) { return $result; } // Consultazione Database $result = self::where(self::$id, $identifier) ->orWhere(self::$name, $identifier) ->first(); self::$collection->push($result); return $result; } /** * Restituisce l'oggetto attualmente impostato. * * @return StoreTrait */ public static function getCurrent() { if (!isset(self::$current)) { return null; } return self::get(self::$current); } /** * Imposta il modulo attualmente in utilizzo. * * @param int $id */ public static function setCurrent($id) { self::$current = $id; } }