PHP 8.2.30
Preview: SettingController.php Size: 5.50 KB
/home/byroehnu/easetack.com/app/Http/Controllers/Admin/SettingController.php

<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use App\Http\Requests\Admin\Settings\CurrencySettingUpdateRequest;
use App\Http\Requests\Admin\Settings\FacebookLoginUpdateRequest;
use App\Http\Requests\Admin\Settings\GoogleLoginUpdateRequest;
use App\Http\Requests\Backend\SmtpSettingUpdateRequest;
use App\Models\Page;
use App\Repositories\SettingRepository;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Inertia\Inertia;

class SettingController extends Controller
{

    public function __construct()
    {
        // for demo mood
        $this->middleware('demo', ['only' => ['paymentGatewayUpdate', 'smtpUpdate', 'commonSettingsUpdate', 'googleCaptchaUpdate', 'pageSettingUpdate', 'currencySettingUpdate', 'invoiceSettingUpdate', 'googleLoginUpdate', 'facebookLoginUpdate']]);
    }

    public function commonSettings(SettingRepository $repository)
    {
        $data['get_common_settings'] = $repository->getCommonSettingConfiguration();

        return Inertia::render('Settings/CommonSettings', $data);
    }

    public function commonSettingsUpdate(Request $request, SettingRepository $repository)
    {
        $repository->updateCommonSettingConfigure($request->all());

        return back()->with('success', 'Common settings has been updated');
    }

    public function googleCaptcha(SettingRepository $repository)
    {
        $data['get_captcha_config'] = $repository->getGoogleCaptchaConfiguration();

        return Inertia::render('Settings/GoogleCaptcha', $data);
    }

    public function googleCaptchaUpdate(Request $request, SettingRepository $repository)
    {
        $repository->updateGoogleCaptchaConfigure($request->all());

        return back()->with('success', 'Google captcha settings has been updated');
    }

    public function paymentGateway(SettingRepository $repository)
    {
        $data['gateway_credentials'] = $repository->getPaymentGatewayConfiguration();

        return Inertia::render('Settings/PaymentGateway', $data);
    }

    public function paymentGatewayUpdate(Request $request, SettingRepository $repository)
    {
        $repository->updatePaymentGatewayConfigure($request->all());

        return back()->with('success', 'Payment settings has been update');
    }

    public function smtpSetting(SettingRepository $repository)
    {
        $data['smtp_config'] = $repository->getSmtpConfiguration();

        return Inertia::render('Settings/SmtpSettings', $data);
    }

    public function smtpUpdate(SmtpSettingUpdateRequest $request, SettingRepository $repository)
    {
        $repository->updateEnvByKey($request->all());

        return back()->with('success', 'Mail setting has been updated');
    }

    /**
     * Show page setting form.
     */
    public function pageSetting(SettingRepository $repository)
    {
        $data['pages'] = Page::with('content')->get();
        $data['page_info'] = $repository->getPageSettingInfo();

        return Inertia::render('Settings/PageSetting', $data);
    }

    /**
     * Update page setting information.
     */
    public function pageSettingUpdate(Request $request, SettingRepository $repository)
    {
        $repository->updatePageSetting($request->all());

        return back()->with('success', 'Page setting updated successfully!');
    }

    /**
     * Update the specified resource.
     */
    public function changeLang($lang): RedirectResponse
    {
        session()->put('lang', $lang);

        return back()->with('success', 'Language successfully changed');
    }

    /**
     * Show currency setting form.
     */
    public function currencySetting(SettingRepository $repository)
    {
        $data['currency_info'] = $repository->getCurrencySettingInfo();

        return Inertia::render('Settings/CurrencySettings', $data);
    }

    /**
     * Update currency setting information.
     */
    public function currencySettingUpdate(CurrencySettingUpdateRequest $request, SettingRepository $repository)
    {
        $repository->updateCurrencySetting($request->all());

        return back()->with('success', 'Currency setting updated successfully!');
    }

    /**
     * Invoice settings.
     */
    public function invoiceSetting(SettingRepository $repository)
    {
        $data['invoice_setting'] = $repository->getInvoiceSettings();

        return Inertia::render('Settings/InvoiceSetting', $data);
    }

    /**
     * Update Social Login.
     */
    public function invoiceSettingUpdate(Request $request, SettingRepository $repository)
    {
        $repository->updateInvoiceSettings($request->all());

        return back()->with('success', 'Invoice setting updated successfully!');
    }

    /**
     * Social Login configuration.
     */
    public function socialLogin(SettingRepository $repository)
    {
        $data['social_media_config'] = $repository->getSocialMediaConfig();

        return Inertia::render('Settings/SocialLogin', $data);
    }

    /**
     * Update Social Login.
     */
    public function googleLoginUpdate(GoogleLoginUpdateRequest $request, SettingRepository $repository)
    {
        $repository->updateGoogleLoginConfig($request->all());

        return back()->with('success', 'Google login configuration updated successfully!');
    }

    /**
     * Update Social Login.
     */
    public function facebookLoginUpdate(FacebookLoginUpdateRequest $request, SettingRepository $repository)
    {
        $repository->updateFacebookLoginConfig($request->all());

        return back()->with('success', 'Facebook login configuration updated successfully!');
    }
}

Directory Contents

Dirs: 0 × Files: 40

Name Size Perms Modified Actions
1.15 KB lrw-rw-rw- 2025-05-04 10:56:26
Edit Download
3.88 KB lrw-rw-rw- 2025-05-08 11:48:26
Edit Download
5.44 KB lrw-rw-rw- 2025-05-08 11:48:26
Edit Download
3.97 KB lrw-rw-rw- 2025-05-01 09:00:37
Edit Download
1.95 KB lrw-rw-rw- 2025-05-01 09:00:37
Edit Download
1.91 KB lrw-rw-rw- 2025-05-01 09:00:37
Edit Download
3.00 KB lrw-rw-rw- 2025-05-08 11:48:26
Edit Download
2.07 KB lrw-rw-rw- 2025-05-01 09:00:37
Edit Download
1.09 KB lrw-rw-rw- 2025-05-01 09:00:37
Edit Download
411 B lrw-rw-rw- 2025-04-08 04:12:56
Edit Download
1.66 KB lrw-rw-rw- 2025-05-05 10:37:43
Edit Download
2.75 KB lrw-rw-rw- 2025-05-01 09:00:37
Edit Download
3.09 KB lrw-rw-rw- 2025-05-15 11:24:11
Edit Download
4.47 KB lrw-rw-rw- 2025-05-01 09:00:37
Edit Download
1.89 KB lrw-rw-rw- 2025-05-01 09:00:37
Edit Download
4.12 KB lrw-rw-rw- 2025-05-08 11:48:26
Edit Download
5.40 KB lrw-rw-rw- 2025-05-17 12:58:43
Edit Download
169 B lrw-rw-rw- 2025-04-19 04:22:19
Edit Download
1.01 KB lrw-rw-rw- 2025-04-19 04:22:19
Edit Download
3.82 KB lrw-rw-rw- 2025-05-08 11:48:26
Edit Download
5.51 KB lrw-rw-rw- 2025-05-08 11:48:26
Edit Download
5.19 KB lrw-rw-rw- 2025-05-01 09:00:37
Edit Download
3.20 KB lrw-rw-rw- 2025-05-01 09:00:37
Edit Download
3.59 KB lrw-rw-rw- 2025-05-08 11:48:26
Edit Download
3.52 KB lrw-rw-rw- 2025-05-08 11:48:26
Edit Download
2.54 KB lrw-rw-rw- 2025-05-08 11:48:26
Edit Download
1.18 KB lrw-rw-rw- 2025-05-08 11:48:26
Edit Download
2.79 KB lrw-rw-rw- 2025-05-01 09:00:37
Edit Download
459 B lrw-rw-rw- 2025-04-19 04:22:18
Edit Download
3.74 KB lrw-rw-rw- 2025-05-08 11:48:26
Edit Download
5.54 KB lrw-rw-rw- 2025-05-08 11:48:26
Edit Download
5.50 KB lrw-rw-rw- 2025-05-01 09:00:37
Edit Download
1.78 KB lrw-rw-rw- 2025-05-01 09:00:37
Edit Download
1.77 KB lrw-rw-rw- 2025-05-01 09:00:37
Edit Download
4.79 KB lrw-rw-rw- 2025-05-08 11:48:26
Edit Download
2.98 KB lrw-rw-rw- 2025-04-19 04:22:19
Edit Download
847 B lrw-rw-rw- 2025-04-08 04:12:56
Edit Download
2.32 KB lrw-rw-rw- 2025-05-01 09:00:37
Edit Download
1.77 KB lrw-rw-rw- 2025-05-01 09:00:37
Edit Download
2.63 KB lrw-rw-rw- 2025-05-01 09:00:37
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).