Skocz do zawartości

Syndrom

WHT Pro
  • Zawartość

    328
  • Rejestracja

  • Ostatnio

  • Wygrane dni

    5

Posty napisane przez Syndrom


  1. Niestety nic to nie daje, nawet jak dodaje bezpośrednio w modelu, bez przeciążania

    Przeciążyłem tą metodę:

    protected function asDateTime($value)
            {
                    // If this value is an integer, we will assume it is a UNIX timestamp's value
                    // and format a Carbon object from this timestamp. This allows flexibility
                    // when defining your date fields as they might be UNIX timestamps here.
                    if (is_numeric($value))
                    {
                            return Carbon::createFromTimestamp($value);
                    }
    
                    // If the value is in simply year, month, day format, we will instantiate the
                    // Carbon instances from that format. Again, this provides for simple date
                    // fields on the database, while still supporting Carbonized conversion.
                    elseif (preg_match('/^(\d{4})-(\d{2})-(\d{2})$/', $value))
                    {
                            return Carbon::createFromFormat('Y-m-d', $value)->startOfDay();
                    }
    
                    // Finally, we will just assume this date is in the format used by default on
                    // the database connection and use that format to create the Carbon object
                    // that is returned back out to the developers after we convert it here.
                    elseif ( ! $value instanceof DateTime)
                    {
                            $format = $this->getDateFormat();
                            return $value;
                    }
    
                    return Carbon::instance($value);
            }
    
    

    i zmieniłem fragment:

                            return Carbon::createFromFormat($format, $value);
    

    Nie wiem dlaczego tak się dzieje, ważne, że działa.

     

    Może mi ktoś wytłumaczyć, bo to pewnie jest jakiś syf to co zrobiłem


  2. Log::error mam po to by debugować co mi zwróciło.

    Tak samo odwrócenia ifa to nie jest rozwiązanie problemu, jeśli w kolekcji skądś się bierze ta "1" na początku pierwszej pętli.

     

    Dodam tylko, że jak robię where tylko po tym polu to przy 1 zwrocie mam ta jedynkę. Jak robię where po każdym innym polu to jest ok:

    [2017-01-19 17:24:35] local.ERROR: [{"id":"30","do":"3","cena":"5.55","szt":"1"}]
    [2017-01-19 17:24:35] local.ERROR: [{"id":"31","do":"3","cena":"5.55","szt":"1"}]
    

    To może w ogóle mam zły algorytm.

    Mam kolekcję $offer (30 elementów) oraz kolekcję $offerstats (2 elementy)

    i teraz chcę zrobić iterację po elementach z $offer i jeśli znajdzie dane ID w $offerstats to ma pobrać dla kilka danych z offerstats dla tego ID.


  3. Mam problem z metodą where() dla kolekcji:

    foreach ($offers as $offer) {
          $col = $offerstats->where('id',$offer->id);
          if (!$col->isEmpty()) {
                Log::error($col);
    (.....)
    

    Pierwszy wynik zwraca mi zawsze z "1" cokolwiek to znaczy:

    [2017-01-19 01:44:25] local.ERROR: {"1":{"id":"3275042","do":"3","cena":"4.35","szt":"1"}}
    [2017-01-19 01:44:25] local.ERROR: [{"id":"3082727","do":"3","cena":"5.55","szt":"1"}]
    
    

    Dlaczego tak się dzieje? Wersja 5.0.27


  4. Witam,

    Chciałbym konfigurować autorespondera bezpośrendio w bazie danycj. Jednak po ustawiniu pól:

     

    autoresponder,

    autoresponder_start_date,

    autoresponder_end_date,

    autoresponder_subject,

    autoresponder_text

     

    w tabeli mail_user i wykonaniu crona, filtr .sieve nie jest ustawiany.

    Z panelu ispconfig wszystko działa w porzo, zapomniałem o jakimś kruczku ?

    Ktoś walczył z tym tematem?

     

×