Пример #1
0
    {
        if (!$this->subdomain) {
            return true;
        }
        $server = explode('.', $host);
        $subdomain = $server[0];
        if (!in_array($subdomain, ['app', 'www']) && $subdomain != $this->subdomain) {
            return false;
        }
        return true;
    }
    public function showCustomField($field, $entity)
    {
        if ($this->isPro()) {
            return $this->{$field} ? true : false;
        }
        if (!$entity) {
            return false;
        }
        // convert (for example) 'custom_invoice_label1' to 'invoice.custom_value1'
        $field = str_replace(['invoice_', 'label'], ['', 'value'], $field);
        return Utils::isEmpty($entity->{$field}) ? false : true;
    }
    public function attatchPDF()
    {
        return $this->isPro() && $this->pdf_email_attachment;
    }
}
Account::updated(function ($account) {
    Event::fire(new UserSettingsChanged());
});
Пример #2
0
    }
    /**
     * @return array
     */
    public function getFontsData()
    {
        $data = [];
        foreach ($this->getFonts() as $font) {
            $data[] = Utils::getFromCache($font, 'fonts');
        }
        return $data;
    }
    /**
     * @return array
     */
    public function getFontFolders()
    {
        return array_map(function ($item) {
            return $item['folder'];
        }, $this->getFontsData());
    }
}
Account::updated(function ($account) {
    // prevent firing event if the invoice/quote counter was changed
    // TODO: remove once counters are moved to separate table
    $dirty = $account->getDirty();
    if (isset($dirty['invoice_number_counter']) || isset($dirty['quote_number_counter'])) {
        return;
    }
    Event::fire(new UserSettingsChanged());
});