App\Http\Controllers\AccountController::saveInvoiceDesign PHP Method

saveInvoiceDesign() private method

private saveInvoiceDesign ( ) : Illuminate\Http\RedirectResponse
return Illuminate\Http\RedirectResponse
    private function saveInvoiceDesign()
    {
        if (Auth::user()->account->hasFeature(FEATURE_CUSTOMIZE_INVOICE_DESIGN)) {
            $account = Auth::user()->account;
            $account->hide_quantity = Input::get('hide_quantity') ? true : false;
            $account->hide_paid_to_date = Input::get('hide_paid_to_date') ? true : false;
            $account->all_pages_header = Input::get('all_pages_header') ? true : false;
            $account->all_pages_footer = Input::get('all_pages_footer') ? true : false;
            $account->invoice_embed_documents = Input::get('invoice_embed_documents') ? true : false;
            $account->header_font_id = Input::get('header_font_id');
            $account->body_font_id = Input::get('body_font_id');
            $account->primary_color = Input::get('primary_color');
            $account->secondary_color = Input::get('secondary_color');
            $account->invoice_design_id = Input::get('invoice_design_id');
            $account->font_size = intval(Input::get('font_size'));
            $account->page_size = Input::get('page_size');
            $account->live_preview = Input::get('live_preview') ? true : false;
            // Automatically disable live preview when using a large font
            $fonts = Cache::get('fonts')->filter(function ($font) use($account) {
                if ($font->google_font) {
                    return false;
                }
                return $font->id == $account->header_font_id || $font->id == $account->body_font_id;
            });
            if ($account->live_preview && count($fonts)) {
                $account->live_preview = false;
                Session::flash('warning', trans('texts.live_preview_disabled'));
            }
            $labels = [];
            foreach (['item', 'description', 'unit_cost', 'quantity', 'line_total', 'terms', 'balance_due', 'partial_due', 'subtotal', 'paid_to_date', 'discount', 'tax'] as $field) {
                $labels[$field] = Input::get("labels_{$field}");
            }
            $account->invoice_labels = json_encode($labels);
            $account->invoice_fields = Input::get('invoice_fields_json');
            $account->save();
            Session::flash('message', trans('texts.updated_settings'));
        }
        return Redirect::to('settings/' . ACCOUNT_INVOICE_DESIGN);
    }

Usage Example

 public function doSection($section = ACCOUNT_COMPANY_DETAILS)
 {
     if ($section === ACCOUNT_COMPANY_DETAILS) {
         return AccountController::saveDetails();
     } elseif ($section === ACCOUNT_USER_DETAILS) {
         return AccountController::saveUserDetails();
     } elseif ($section === ACCOUNT_LOCALIZATION) {
         return AccountController::saveLocalization();
     } elseif ($section === ACCOUNT_IMPORT_EXPORT) {
         return AccountController::importFile();
     } elseif ($section === ACCOUNT_MAP) {
         return AccountController::mapFile();
     } elseif ($section === ACCOUNT_NOTIFICATIONS) {
         return AccountController::saveNotifications();
     } elseif ($section === ACCOUNT_EXPORT) {
         return AccountController::export();
     } elseif ($section === ACCOUNT_INVOICE_SETTINGS) {
         return AccountController::saveInvoiceSettings();
     } elseif ($section === ACCOUNT_INVOICE_DESIGN) {
         return AccountController::saveInvoiceDesign();
     } elseif ($section === ACCOUNT_CUSTOMIZE_DESIGN) {
         return AccountController::saveCustomizeDesign();
     } elseif ($section === ACCOUNT_TEMPLATES_AND_REMINDERS) {
         return AccountController::saveEmailTemplates();
     } elseif ($section === ACCOUNT_PRODUCTS) {
         return AccountController::saveProducts();
     } elseif ($section === ACCOUNT_TAX_RATES) {
         return AccountController::saveTaxRates();
     }
 }
All Usage Examples Of App\Http\Controllers\AccountController::saveInvoiceDesign