first upload all files
This commit is contained in:
391
Modules/Setting/Admin/SettingTabs.php
Normal file
391
Modules/Setting/Admin/SettingTabs.php
Normal file
@@ -0,0 +1,391 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Setting\Admin;
|
||||
|
||||
use Modules\Admin\Ui\Tab;
|
||||
use Modules\Admin\Ui\Tabs;
|
||||
use Modules\Support\Locale;
|
||||
use Modules\Support\Country;
|
||||
use Modules\Support\TimeZone;
|
||||
use Modules\Currency\Currency;
|
||||
use Modules\User\Entities\Role;
|
||||
|
||||
class SettingTabs extends Tabs
|
||||
{
|
||||
/**
|
||||
* Make new tabs with groups.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function make()
|
||||
{
|
||||
$this->group('general_settings', trans('setting::settings.tabs.group.general_settings'))
|
||||
->active()
|
||||
->add($this->general())
|
||||
->add($this->maintenance())
|
||||
->add($this->store())
|
||||
->add($this->currency())
|
||||
->add($this->sms())
|
||||
->add($this->mail())
|
||||
->add($this->newsletter())
|
||||
->add($this->customCssJs());
|
||||
|
||||
$this->group('social_logins', trans('setting::settings.tabs.group.social_logins'))
|
||||
->add($this->facebook())
|
||||
->add($this->google());
|
||||
|
||||
$this->group('shipping_methods', trans('setting::settings.tabs.group.shipping_methods'))
|
||||
->add($this->freeShipping())
|
||||
->add($this->localPickup())
|
||||
->add($this->flatRate());
|
||||
|
||||
$this->group('payment_methods', trans('setting::settings.tabs.group.payment_methods'))
|
||||
->add($this->paypal())
|
||||
->add($this->stripe())
|
||||
->add($this->paytm())
|
||||
->add($this->razorpay())
|
||||
->add($this->instamojo())
|
||||
->add($this->authorizenet())
|
||||
->add($this->paystack())
|
||||
->add($this->mercadopago())
|
||||
->add($this->flutterwave())
|
||||
->add($this->cod())
|
||||
->add($this->bankTransfer())
|
||||
->add($this->checkPayment());
|
||||
}
|
||||
|
||||
|
||||
private function general()
|
||||
{
|
||||
return tap(new Tab('general', trans('setting::settings.tabs.general')), function (Tab $tab) {
|
||||
$tab->active();
|
||||
$tab->weight(5);
|
||||
|
||||
$tab->fields(['supported_countries.*', 'default_country', 'supported_locales.*', 'default_locale', 'default_timezone', 'customer_role']);
|
||||
|
||||
$tab->view('setting::admin.settings.tabs.general', [
|
||||
'locales' => Locale::all(),
|
||||
'countries' => Country::all(),
|
||||
'timeZones' => TimeZone::all(),
|
||||
'roles' => Role::list(),
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function maintenance()
|
||||
{
|
||||
return tap(new Tab('maintenance', trans('setting::settings.tabs.maintenance')), function (Tab $tab) {
|
||||
$tab->weight(7);
|
||||
$tab->view('setting::admin.settings.tabs.maintenance');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function store()
|
||||
{
|
||||
return tap(new Tab('store', trans('setting::settings.tabs.store')), function (Tab $tab) {
|
||||
$tab->weight(10);
|
||||
|
||||
$tab->fields(['translatable.store_name', 'translatable.store_tagline', 'store_phone', 'store_email', 'store_address_1', 'store_address_2', 'store_city', 'store_country', 'store_state', 'store_zip']);
|
||||
|
||||
$tab->view('setting::admin.settings.tabs.store', [
|
||||
'countries' => Country::all(),
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function currency()
|
||||
{
|
||||
return tap(new Tab('currency', trans('setting::settings.tabs.currency')), function (Tab $tab) {
|
||||
$tab->weight(20);
|
||||
|
||||
$tab->fields(['supported_currencies.*', 'default_currency', 'currency_rate_exchange_service', 'fixer_access_key', 'forge_api_key', 'currency_data_feed_api_key', 'auto_refresh_currency_rates', 'auto_refresh_currency_rate_frequency']);
|
||||
|
||||
$tab->view('setting::admin.settings.tabs.currency', [
|
||||
'currencies' => Currency::names(),
|
||||
'currencyRateExchangeServices' => $this->getCurrencyRateExchangeServices(),
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function getCurrencyRateExchangeServices()
|
||||
{
|
||||
$currencyRateExchangeServices = ['' => trans('setting::settings.form.select_service')];
|
||||
|
||||
return $currencyRateExchangeServices += trans('currency::services');
|
||||
}
|
||||
|
||||
|
||||
private function sms()
|
||||
{
|
||||
return tap(new Tab('sms', trans('setting::settings.tabs.sms')), function (Tab $tab) {
|
||||
$tab->weight(25);
|
||||
|
||||
$tab->fields(['sms_service', 'vonage_key', 'vonage_secret', 'twilio_sid', 'twilio_token', 'sms_order_statuses']);
|
||||
|
||||
$tab->view('setting::admin.settings.tabs.sms', [
|
||||
'smsServices' => $this->getSmsServices(),
|
||||
'orderStatuses' => trans('order::statuses'),
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function getSmsServices()
|
||||
{
|
||||
$smsServices = ['' => trans('setting::settings.form.select_service')];
|
||||
|
||||
return $smsServices += trans('sms::services');
|
||||
}
|
||||
|
||||
|
||||
private function mail()
|
||||
{
|
||||
return tap(new Tab('mail', trans('setting::settings.tabs.mail')), function (Tab $tab) {
|
||||
$tab->weight(30);
|
||||
$tab->fields(['mail_from_address']);
|
||||
$tab->view('setting::admin.settings.tabs.mail', [
|
||||
'encryptionProtocols' => $this->getMailEncryptionProtocols(),
|
||||
'orderStatuses' => trans('order::statuses'),
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function getMailEncryptionProtocols()
|
||||
{
|
||||
return ['' => trans('admin::admin.form.please_select')] + trans('setting::settings.form.mail_encryption_protocols');
|
||||
}
|
||||
|
||||
|
||||
private function newsletter()
|
||||
{
|
||||
return tap(new Tab('newsletter', trans('setting::settings.tabs.newsletter')), function (Tab $tab) {
|
||||
$tab->weight(32);
|
||||
$tab->fields(['newsletter_enabled', 'mailchimp_api_key', 'mailchimp_list_id']);
|
||||
$tab->view('setting::admin.settings.tabs.newsletter');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function customCssJs()
|
||||
{
|
||||
return tap(new Tab('custom_css_js', trans('setting::settings.tabs.custom_css_js')), function (Tab $tab) {
|
||||
$tab->weight(35);
|
||||
$tab->view('setting::admin.settings.tabs.custom_css_js');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function facebook()
|
||||
{
|
||||
return tap(new Tab('facebook', trans('setting::settings.tabs.facebook')), function (Tab $tab) {
|
||||
$tab->weight(38);
|
||||
|
||||
$tab->fields(['facebook_login_enabled', 'translatable.facebook_login_label', 'facebook_login_app_id', 'facebook_login_app_secret']);
|
||||
|
||||
$tab->view('setting::admin.settings.tabs.facebook');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function google()
|
||||
{
|
||||
return tap(new Tab('google', trans('setting::settings.tabs.google')), function (Tab $tab) {
|
||||
$tab->weight(39);
|
||||
|
||||
$tab->fields(['google_login_enabled', 'translatable.google_login_label', 'google_login_client_id', 'google_login_client_secret']);
|
||||
|
||||
$tab->view('setting::admin.settings.tabs.google');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function freeShipping()
|
||||
{
|
||||
return tap(new Tab('free_shipping', trans('setting::settings.tabs.free_shipping')), function (Tab $tab) {
|
||||
$tab->weight(40);
|
||||
$tab->fields(['free_shipping_enabled', 'translatable.free_shipping_label']);
|
||||
$tab->view('setting::admin.settings.tabs.free_shipping');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function localPickup()
|
||||
{
|
||||
return tap(new Tab('local_pickup', trans('setting::settings.tabs.local_pickup')), function (Tab $tab) {
|
||||
$tab->weight(45);
|
||||
$tab->fields(['local_pickup_enabled', 'translatable.local_pickup_label']);
|
||||
$tab->view('setting::admin.settings.tabs.local_pickup');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function flatRate()
|
||||
{
|
||||
return tap(new Tab('flat_rate', trans('setting::settings.tabs.flat_rate')), function (Tab $tab) {
|
||||
$tab->weight(50);
|
||||
|
||||
$tab->fields(['flat_rate_enabled', 'translatable.flat_rate_label', 'flat_rate_cost']);
|
||||
|
||||
$tab->view('setting::admin.settings.tabs.flat_rate');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function paypal()
|
||||
{
|
||||
return tap(new Tab('paypal', trans('setting::settings.tabs.paypal')), function (Tab $tab) {
|
||||
$tab->weight(61);
|
||||
|
||||
$tab->fields(['paypal_enabled', 'translatable.paypal_label', 'translatable.paypal_description', 'paypal_env', 'paypal_client_id', 'paypal_secret']);
|
||||
|
||||
$tab->view('setting::admin.settings.tabs.paypal');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function stripe()
|
||||
{
|
||||
return tap(new Tab('stripe', trans('setting::settings.tabs.stripe')), function (Tab $tab) {
|
||||
$tab->weight(62);
|
||||
|
||||
$tab->fields(['stripe_enabled', 'translatable.stripe_label', 'translatable.stripe_description', 'stripe_publishable_key', 'stripe_secret_key']);
|
||||
|
||||
$tab->view('setting::admin.settings.tabs.stripe');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function paytm()
|
||||
{
|
||||
return tap(new Tab('paytm', trans('setting::settings.tabs.paytm')), function (Tab $tab) {
|
||||
$tab->weight(63);
|
||||
|
||||
$tab->fields(['paytm_enabled', 'paytm_label', 'paytm_description', 'paytm_merchant_id', 'paytm_merchant_key']);
|
||||
|
||||
$tab->view('setting::admin.settings.tabs.paytm');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function razorpay()
|
||||
{
|
||||
return tap(new Tab('razorpay', trans('setting::settings.tabs.razorpay')), function (Tab $tab) {
|
||||
$tab->weight(64);
|
||||
|
||||
$tab->fields(['razorpay_enabled', 'razorpay_label', 'razorpay_description', 'razorpay_key_id', 'razorpay_key_secret']);
|
||||
|
||||
$tab->view('setting::admin.settings.tabs.razorpay');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function instamojo()
|
||||
{
|
||||
return tap(new Tab('instamojo', trans('setting::settings.tabs.instamojo')), function (Tab $tab) {
|
||||
$tab->weight(65);
|
||||
|
||||
$tab->fields(['instamojo_enabled', 'instamojo_label', 'instamojo_description', 'instamojo_test_mode', 'instamojo_api_key', 'instamojo_auth_token']);
|
||||
|
||||
$tab->view('setting::admin.settings.tabs.instamojo');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function paystack()
|
||||
{
|
||||
return tap(new Tab('paystack', trans('setting::settings.tabs.paystack')), function (Tab $tab) {
|
||||
$tab->weight(66);
|
||||
|
||||
$tab->fields(['paystack_enabled', 'paystack_label', 'paystack_description', 'paystack_test_mode','paystack_public_key','paystack_secret_key']);
|
||||
|
||||
$tab->view('setting::admin.settings.tabs.paystack');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function authorizenet()
|
||||
{
|
||||
return tap(new Tab('authorizenet', trans('setting::settings.tabs.authorizenet')), function (Tab $tab) {
|
||||
$tab->weight(67);
|
||||
|
||||
$tab->fields(['authorizenet_enabled', 'authorizenet_label', 'authorizenet_description', 'authorizenet_test_mode', 'authorizenet_merchant_login_id', 'authorizenet_merchant_transaction_key']);
|
||||
|
||||
$tab->view('setting::admin.settings.tabs.authorizenet');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function mercadopago()
|
||||
{
|
||||
return tap(new Tab('mercadopago', trans('setting::settings.tabs.mercadopago')), function (Tab $tab) {
|
||||
$tab->weight(68);
|
||||
|
||||
$currencies = array_combine(
|
||||
\Modules\Payment\Gateways\MercadoPago::CURRENCIES,
|
||||
array_map(function ($currency) {
|
||||
return Currency::name($currency);
|
||||
}, \Modules\Payment\Gateways\MercadoPago::CURRENCIES),
|
||||
);
|
||||
|
||||
$tab->fields(['mercadopago_enabled', 'mercadopago_label', 'mercadopago_description', 'mercadopago_supported_currency', 'mercadopago_test_mode', 'mercadopago_public_key', 'mercadopago_access_token']);
|
||||
|
||||
$tab->view('setting::admin.settings.tabs.mercadopago', [
|
||||
'currencies' => $currencies,
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function flutterwave()
|
||||
{
|
||||
return tap(new Tab('flutterwave', trans('setting::settings.tabs.flutterwave')), function (Tab $tab) {
|
||||
$tab->weight(69);
|
||||
|
||||
$tab->fields(['flutterwave_enabled', 'flutterwave_label', 'flutterwave_description', 'flutterwave_test_mode', 'flutterwave_public_key', 'flutterwave_secret_key', 'flutterwave_encryption_key']);
|
||||
|
||||
$tab->view('setting::admin.settings.tabs.flutterwave');
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
private function cod()
|
||||
{
|
||||
return tap(new Tab('cod', trans('setting::settings.tabs.cod')), function (Tab $tab) {
|
||||
$tab->weight(70);
|
||||
|
||||
$tab->fields(['cod_enabled', 'translatable.cod_label', 'translatable.cod_description']);
|
||||
|
||||
$tab->view('setting::admin.settings.tabs.cod');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function bankTransfer()
|
||||
{
|
||||
return tap(new Tab('bank_transfer', trans('setting::settings.tabs.bank_transfer')), function (Tab $tab) {
|
||||
$tab->weight(71);
|
||||
|
||||
$tab->fields(['bank_transfer_enabled', 'translatable.bank_transfer_label', 'translatable.bank_transfer_description', 'translatable.bank_transfer_instructions']);
|
||||
|
||||
$tab->view('setting::admin.settings.tabs.bank_transfer');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function checkPayment()
|
||||
{
|
||||
return tap(new Tab('check_payment', trans('setting::settings.tabs.check_payment')), function (Tab $tab) {
|
||||
$tab->weight(72);
|
||||
|
||||
$tab->fields(['check_payment_enabled', 'translatable.check_payment_label', 'translatable.check_payment_description', 'translatable.check_payment_instructions']);
|
||||
|
||||
$tab->view('setting::admin.settings.tabs.check_payment');
|
||||
});
|
||||
}
|
||||
}
|
||||
21
Modules/Setting/Config/assets.php
Normal file
21
Modules/Setting/Config/assets.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Define which assets will be available through the asset manager
|
||||
|--------------------------------------------------------------------------
|
||||
| These assets are registered on the asset manager
|
||||
*/
|
||||
'all_assets' => [
|
||||
'admin.setting.js' => ['module' => 'setting:admin/js/setting.js'],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Define which default assets will always be included in your pages
|
||||
| through the asset pipeline
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'required_assets' => [],
|
||||
];
|
||||
7
Modules/Setting/Config/permissions.php
Normal file
7
Modules/Setting/Config/permissions.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'admin.settings' => [
|
||||
'edit' => 'setting::permissions.edit',
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateSettingsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('settings', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('key')->unique();
|
||||
$table->boolean('is_translatable')->default(false);
|
||||
$table->text('plain_value')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('settings');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateSettingTranslationsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('setting_translations', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('setting_id')->unsigned();
|
||||
$table->string('locale');
|
||||
$table->longText('value')->nullable();
|
||||
|
||||
$table->unique(['setting_id', 'locale']);
|
||||
$table->foreign('setting_id')->references('id')->on('settings')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('setting_translations');
|
||||
}
|
||||
}
|
||||
69
Modules/Setting/Database/Seeders/SettingDatabaseSeeder.php
Normal file
69
Modules/Setting/Database/Seeders/SettingDatabaseSeeder.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Setting\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Modules\Setting\Entities\Setting;
|
||||
|
||||
class SettingDatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Setting::setMany([
|
||||
'active_theme' => 'Storefront',
|
||||
'supported_countries' => ['BD'],
|
||||
'default_country' => 'BD',
|
||||
'supported_locales' => ['en'],
|
||||
'default_locale' => 'en',
|
||||
'default_timezone' => 'Asia/Dhaka',
|
||||
'customer_role' => 2,
|
||||
'reviews_enabled' => true,
|
||||
'auto_approve_reviews' => true,
|
||||
'cookie_bar_enabled' => true,
|
||||
'supported_currencies' => ['USD'],
|
||||
'default_currency' => 'USD',
|
||||
'send_order_invoice_email' => false,
|
||||
'store_email' => 'admin@fleetcart.test',
|
||||
'newsletter_enabled' => false,
|
||||
'search_engine' => 'mysql',
|
||||
'local_pickup_cost' => 0,
|
||||
'flat_rate_cost' => 0,
|
||||
'translatable' => [
|
||||
'store_name' => 'FleetCart',
|
||||
'free_shipping_label' => 'Free Shipping',
|
||||
'local_pickup_label' => 'Local Pickup',
|
||||
'flat_rate_label' => 'Flat Rate',
|
||||
'paypal_label' => 'PayPal',
|
||||
'paypal_description' => 'Pay via your PayPal account.',
|
||||
'stripe_label' => 'Stripe',
|
||||
'stripe_description' => 'Pay via credit or debit card.',
|
||||
'paytm_label' => 'Paytm',
|
||||
'paytm_description' => 'The best payment gateway provider in India for e-payment through credit card, debit card & net banking.',
|
||||
'razorpay_label' => 'Razorpay',
|
||||
'razorpay_description' => 'Pay securely by Credit or Debit card or Internet Banking through Razorpay.',
|
||||
'instamojo_label' => 'Instamojo',
|
||||
'instamojo_description' => 'CC/DB/NB/Wallets',
|
||||
'authorizenet_label' => 'Authorize.net',
|
||||
'authorizenet_description' => 'Accept payments anytime, anywhere',
|
||||
'paystack_label' => 'Paystack',
|
||||
'paystack_description' => 'Modern online and offline payments for Africa',
|
||||
'mercadopago_label'=> 'Mercado Pago',
|
||||
'mercadopago_description'=>'From now on, do more with your money',
|
||||
'flutterwave_label' => 'Flutterwave',
|
||||
'flutterwave_description' => 'Endless possibilities for every business',
|
||||
'cod_label' => 'Cash On Delivery',
|
||||
'cod_description' => 'Pay with cash upon delivery.',
|
||||
'bank_transfer_label' => 'Bank Transfer',
|
||||
'bank_transfer_description' => 'Make your payment directly into our bank account. Please use your Order ID as the payment reference.',
|
||||
'check_payment_label' => 'Check / Money Order',
|
||||
'check_payment_description' => 'Please send a check to our store.',
|
||||
],
|
||||
'storefront_copyright_text' => 'Copyright © <a href="{{ store_url }}">{{ store_name }}</a> {{ year }}. All rights reserved.',
|
||||
]);
|
||||
}
|
||||
}
|
||||
159
Modules/Setting/Entities/Setting.php
Normal file
159
Modules/Setting/Entities/Setting.php
Normal file
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Setting\Entities;
|
||||
|
||||
use Modules\Support\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Modules\Setting\Events\SettingSaved;
|
||||
use Modules\Support\Eloquent\Translatable;
|
||||
|
||||
class Setting extends Model
|
||||
{
|
||||
use Translatable;
|
||||
|
||||
/**
|
||||
* The relations to eager load on every query.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $with = ['translations'];
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = ['key', 'is_translatable', 'plain_value'];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'is_translatable' => 'boolean',
|
||||
];
|
||||
|
||||
/**
|
||||
* The event map for the model.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $dispatchesEvents = [
|
||||
'saved' => SettingSaved::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that are translatable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $translatedAttributes = ['value'];
|
||||
|
||||
/**
|
||||
* Get all settings with cache support.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Collection
|
||||
*/
|
||||
public static function allCached()
|
||||
{
|
||||
return Cache::rememberForever(md5('settings.all:' . locale()), function () {
|
||||
return self::all()->mapWithKeys(function ($setting) {
|
||||
return [$setting->key => $setting->value];
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given setting key exists.
|
||||
*
|
||||
* @param string $key
|
||||
* @return bool
|
||||
*/
|
||||
public static function has($key)
|
||||
{
|
||||
return static::where('key', $key)->exists();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get setting for the given key.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $default
|
||||
* @return string|array
|
||||
*/
|
||||
public static function get($key, $default = null)
|
||||
{
|
||||
return static::where('key', $key)->first()->value ?? $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the given setting.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @return void
|
||||
*/
|
||||
public static function set($key, $value)
|
||||
{
|
||||
if ($key === 'translatable') {
|
||||
return static::setTranslatableSettings($value);
|
||||
}
|
||||
|
||||
static::updateOrCreate(['key' => $key], ['plain_value' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the given settings.
|
||||
*
|
||||
* @param array $settings
|
||||
* @return void
|
||||
*/
|
||||
public static function setMany($settings)
|
||||
{
|
||||
foreach ($settings as $key => $value) {
|
||||
self::set($key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a translatable settings.
|
||||
*
|
||||
* @param array $settings
|
||||
* @return void
|
||||
*/
|
||||
public static function setTranslatableSettings($settings = [])
|
||||
{
|
||||
foreach ($settings as $key => $value) {
|
||||
static::updateOrCreate(['key' => $key], [
|
||||
'is_translatable' => true,
|
||||
'value' => $value,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of the setting.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getValueAttribute()
|
||||
{
|
||||
if ($this->is_translatable) {
|
||||
return $this->translateOrDefault(locale())->value ?? null;
|
||||
}
|
||||
|
||||
return unserialize($this->plain_value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of the setting.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return mixed
|
||||
*/
|
||||
public function setPlainValueAttribute($value)
|
||||
{
|
||||
$this->attributes['plain_value'] = serialize($value);
|
||||
}
|
||||
}
|
||||
37
Modules/Setting/Entities/SettingTranslation.php
Normal file
37
Modules/Setting/Entities/SettingTranslation.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Setting\Entities;
|
||||
|
||||
use Modules\Support\Eloquent\TranslationModel;
|
||||
|
||||
class SettingTranslation extends TranslationModel
|
||||
{
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = ['value'];
|
||||
|
||||
/**
|
||||
* Get the value of the setting.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return mixed
|
||||
*/
|
||||
public function getValueAttribute($value)
|
||||
{
|
||||
return unserialize($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of the setting.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return mixed
|
||||
*/
|
||||
public function setValueAttribute($value)
|
||||
{
|
||||
$this->attributes['value'] = serialize($value);
|
||||
}
|
||||
}
|
||||
29
Modules/Setting/Events/SettingSaved.php
Normal file
29
Modules/Setting/Events/SettingSaved.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Setting\Events;
|
||||
|
||||
use Modules\Setting\Entities\Setting;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class SettingSaved
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* The setting model.
|
||||
*
|
||||
* @var \Modules\Setting\Entities\Setting
|
||||
*/
|
||||
public $setting;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param \Modules\Setting\Entities\Setting $order
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Setting $setting)
|
||||
{
|
||||
$this->setting = $setting;
|
||||
}
|
||||
}
|
||||
48
Modules/Setting/Http/Controllers/Admin/SettingController.php
Normal file
48
Modules/Setting/Http/Controllers/Admin/SettingController.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Setting\Http\Controllers\Admin;
|
||||
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Modules\Admin\Ui\Facades\TabManager;
|
||||
use Modules\Setting\Http\Requests\UpdateSettingRequest;
|
||||
|
||||
class SettingController
|
||||
{
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$settings = setting()->all();
|
||||
$tabs = TabManager::get('settings');
|
||||
|
||||
return view('setting::admin.settings.edit', compact('settings', 'tabs'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(UpdateSettingRequest $request)
|
||||
{
|
||||
$this->handleMaintenanceMode($request);
|
||||
|
||||
setting($request->except('_token', '_method'));
|
||||
|
||||
return redirect(non_localized_url())
|
||||
->with('success', trans('setting::messages.settings_have_been_saved'));
|
||||
}
|
||||
|
||||
private function handleMaintenanceMode($request)
|
||||
{
|
||||
if ($request->maintenance_mode) {
|
||||
Artisan::call('down');
|
||||
} elseif (app()->isDownForMaintenance()) {
|
||||
Artisan::call('up');
|
||||
}
|
||||
}
|
||||
}
|
||||
230
Modules/Setting/Http/Requests/UpdateSettingRequest.php
Normal file
230
Modules/Setting/Http/Requests/UpdateSettingRequest.php
Normal file
@@ -0,0 +1,230 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Setting\Http\Requests;
|
||||
|
||||
use Modules\Support\Locale;
|
||||
use Modules\Support\Country;
|
||||
use Modules\Support\TimeZone;
|
||||
use Modules\Currency\Currency;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Modules\Core\Http\Requests\Request;
|
||||
|
||||
class UpdateSettingRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Available attributes.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $availableAttributes = 'setting::attributes';
|
||||
|
||||
/**
|
||||
* Array of attributes that should be merged with null
|
||||
* if attribute is not found in the current request.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $shouldCheck = ['sms_order_statuses', 'email_order_statuses'];
|
||||
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'supported_countries.*' => ['required', Rule::in(Country::codes())],
|
||||
'default_country' => 'required|in_array:supported_countries.*',
|
||||
'supported_locales.*' => ['required', Rule::in(Locale::codes())],
|
||||
'default_locale' => 'required|in_array:supported_locales.*',
|
||||
'default_timezone' => ['required', Rule::in(TimeZone::all())],
|
||||
'customer_role' => ['required', Rule::exists('roles', 'id')],
|
||||
'supported_currencies.*' => ['required', Rule::in(Currency::codes())],
|
||||
'default_currency' => 'required|in_array:supported_currencies.*',
|
||||
|
||||
'translatable.store_name' => 'required',
|
||||
'store_phone' => ['required'],
|
||||
'store_email' => 'required|email',
|
||||
'store_country' => ['required', Rule::in(Country::codes())],
|
||||
|
||||
'fixer_access_key' => 'required_if:currency_rate_exchange_service,fixer',
|
||||
'forge_api_key' => 'required_if:currency_rate_exchange_service,forge',
|
||||
'currency_data_feed_api_key' => 'required_if:currency_rate_exchange_service,currency_data_feed',
|
||||
'auto_refresh_currency_rates' => 'required|boolean',
|
||||
'auto_refresh_currency_rate_frequency' => ['required_if:auto_refresh_currency_rates,1', Rule::in($this->refreshFrequencies())],
|
||||
|
||||
'sms_service' => ['nullable', Rule::in($this->smsServices())],
|
||||
'vonage_key' => ['required_if:sms_service,vonage'],
|
||||
'vonage_secret' => ['required_if:sms_service,vonage'],
|
||||
'twilio_sid' => ['required_if:sms_service,twilio'],
|
||||
'twilio_token' => ['required_if:sms_service,twilio'],
|
||||
'sms_order_statuses.*' => ['nullable', Rule::in($this->orderStatuses())],
|
||||
|
||||
'mail_from_address' => 'nullable|email',
|
||||
'mail_encryption' => ['nullable', Rule::in($this->mailEncryptionProtocols())],
|
||||
|
||||
'newsletter_enabled' => ['required', 'boolean'],
|
||||
'mailchimp_api_key' => ['required_if:newsletter_enabled,1'],
|
||||
'mailchimp_list_id' => ['required_if:newsletter_enabled,1'],
|
||||
|
||||
'facebook_login_enabled' => 'required|boolean',
|
||||
'facebook_login_app_id' => 'required_if:facebook_login_enabled,1',
|
||||
'facebook_login_app_secret' => 'required_if:facebook_login_enabled,1',
|
||||
|
||||
'google_login_enabled' => 'required|boolean',
|
||||
'google_login_client_id' => 'required_if:google_login_enabled,1',
|
||||
'google_login_client_secret' => 'required_if:google_login_enabled,1',
|
||||
|
||||
'free_shipping_enabled' => 'required|boolean',
|
||||
'free_shipping_min_amount' => 'nullable|numeric',
|
||||
'translatable.free_shipping_label' => 'required_if:free_shipping_enabled,1',
|
||||
|
||||
'local_pickup_enabled' => 'required|boolean',
|
||||
'translatable.local_pickup_label' => 'required_if:local_pickup_enabled,1',
|
||||
'local_pickup_cost' => ['required_if:local_pickup_enabled,1', 'nullable', 'numeric'],
|
||||
|
||||
'flat_rate_enabled' => 'required|boolean',
|
||||
'translatable.flat_rate_label' => 'required_if:flat_rate_enabled,1',
|
||||
'flat_rate_cost' => ['required_if:flat_rate_enabled,1', 'nullable', 'numeric'],
|
||||
|
||||
'paypal_enabled' => 'required|boolean',
|
||||
'translatable.paypal_label' => 'required_if:paypal_enabled,1',
|
||||
'translatable.paypal_description' => 'required_if:paypal_enabled,1',
|
||||
'paypal_test_mode' => 'required|boolean',
|
||||
'paypal_client_id' => 'required_if:paypal_enabled,1',
|
||||
'paypal_secret' => 'required_if:paypal_enabled,1',
|
||||
|
||||
'stripe_enabled' => 'required|boolean',
|
||||
'translatable.stripe_label' => 'required_if:stripe_enabled,1',
|
||||
'translatable.stripe_description' => 'required_if:stripe_enabled,1',
|
||||
'stripe_publishable_key' => 'required_if:stripe_enabled,1',
|
||||
'stripe_secret_key' => 'required_if:stripe_enabled,1',
|
||||
|
||||
'paytm_enabled' => 'required|boolean',
|
||||
'translatable.paytm_label' => 'required_if:paytm_enabled,1',
|
||||
'translatable.paytm_description' => 'required_if:paytm_enabled,1',
|
||||
'paytm_merchant_id' => 'required_if:paytm_enabled,1',
|
||||
'paytm_merchant_key' => 'required_if:paytm_enabled,1',
|
||||
|
||||
'razorpay_enabled' => 'required|boolean',
|
||||
'translatable.razorpay_label' => 'required_if:razorpay_enabled,1',
|
||||
'translatable.razorpay_description' => 'required_if:razorpay_enabled,1',
|
||||
'razorpay_key_id' => 'required_if:razorpay_enabled,1',
|
||||
'razorpay_key_secret' => 'required_if:razorpay_enabled,1',
|
||||
|
||||
'instamojo_enabled' => 'required|boolean',
|
||||
'translatable.instamojo_label' => 'required_if:instamojo_enabled,1',
|
||||
'translatable.instamojo_description' => 'required_if:instamojo_enabled,1',
|
||||
'instamojo_test_mode' => 'required|boolean',
|
||||
'instamojo_api_key' => 'required_if:instamojo_enabled,1',
|
||||
'instamojo_auth_token' => 'required_if:instamojo_enabled,1',
|
||||
|
||||
'authorizenet_enabled' => 'required|boolean',
|
||||
'translatable.authorizenet_label' => 'required_if:authorizenet_enabled,1',
|
||||
'translatable.authorizenet_description' => 'required_if:authorizenet_enabled,1',
|
||||
'authorizenet_test_mode' => 'required|boolean',
|
||||
'authorizenet_merchant_login_id' => 'required_if:authorizenet_enabled,1',
|
||||
'authorizenet_merchant_transaction_key' => 'required_if:authorizenet_enabled,1',
|
||||
|
||||
'paystack_enabled' => 'required|boolean',
|
||||
'translatable.paystack_label' => 'required_if:paystack_enabled,1',
|
||||
'translatable.paystack_description' => 'required_if:paystack_enabled,1',
|
||||
'paystack_test_mode' => 'required|boolean',
|
||||
'paystack_public_key' => 'required_if:paystack_enabled,1',
|
||||
'paystack_secret_key' => 'required_if:paystack_enabled,1',
|
||||
|
||||
'mercadopago_enabled' => 'required|boolean',
|
||||
'translatable.mercadopago_label' => 'required_if:mercadopago_enabled,1',
|
||||
'translatable.mercadopago_description' => 'required_if:mercadopago_enabled,1',
|
||||
'mercadopago_test_mode' => 'required|boolean',
|
||||
'mercadopago_supported_currency' => 'required_if:mercadopago_enabled,1',
|
||||
'mercadopago_public_key' => 'required_if:mercadopago_enabled,1',
|
||||
'mercadopago_access_token' => 'required_if:mercadopago_enabled,1',
|
||||
|
||||
'flutterwave_enabled' => 'required|boolean',
|
||||
'translatable.flutterwave_label' => 'required_if:flutterwave_enabled,1',
|
||||
'translatable.flutterwave_description' => 'required_if:flutterwave_enabled,1',
|
||||
'flutterwave_test_mode' => 'required|boolean',
|
||||
'flutterwave_public_key' => 'required_if:flutterwave_enabled,1',
|
||||
'flutterwave_secret_key' => 'required_if:flutterwave_enabled,1',
|
||||
'flutterwave_encryption_key' => 'required_if:flutterwave_enabled,1',
|
||||
|
||||
'cod_enabled' => 'required|boolean',
|
||||
'translatable.cod_label' => 'required_if:cod_enabled,1',
|
||||
'translatable.cod_description' => 'required_if:cod_enabled,1',
|
||||
|
||||
'bank_transfer_enabled' => 'required|boolean',
|
||||
'translatable.bank_transfer_label' => 'required_if:bank_transfer_enabled,1',
|
||||
'translatable.bank_transfer_description' => 'required_if:bank_transfer_enabled,1',
|
||||
'translatable.bank_transfer_instructions' => 'required_if:bank_transfer_enabled,1',
|
||||
|
||||
'check_payment_enabled' => 'required|boolean',
|
||||
'translatable.check_payment_label' => 'required_if:check_payment_enabled,1',
|
||||
'translatable.check_payment_description' => 'required_if:check_payment_enabled,1',
|
||||
'translatable.check_payment_instructions' => 'required_if:check_payment_enabled,1',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns currency rate refresh frequencies..
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function refreshFrequencies()
|
||||
{
|
||||
return array_keys(trans('setting::settings.form.auto_refresh_currency_rate_frequencies'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns SMS services.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function smsServices()
|
||||
{
|
||||
return array_keys(trans('sms::services'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns order statuses.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function orderStatuses()
|
||||
{
|
||||
return array_keys(trans('order::statuses'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns mail encryption protocols.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function mailEncryptionProtocols()
|
||||
{
|
||||
return array_keys(trans('setting::settings.form.mail_encryption_protocols'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get data to be validated from the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function validationData()
|
||||
{
|
||||
foreach ($this->shouldCheck as $attribute) {
|
||||
if (!$this->has($attribute)) {
|
||||
$this->merge([$attribute => null]);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->all();
|
||||
}
|
||||
}
|
||||
20
Modules/Setting/Listeners/ClearSettingCache.php
Normal file
20
Modules/Setting/Listeners/ClearSettingCache.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Setting\Listeners;
|
||||
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
class ClearSettingCache
|
||||
{
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
foreach (supported_locale_keys() as $locale) {
|
||||
Cache::forget(md5('settings.all:' . $locale));
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Modules/Setting/Providers/EventServiceProvider.php
Normal file
19
Modules/Setting/Providers/EventServiceProvider.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Setting\Providers;
|
||||
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The event listener mappings for the application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $listen = [
|
||||
\Modules\Setting\Events\SettingSaved::class => [
|
||||
\Modules\Setting\Listeners\ClearSettingCache::class,
|
||||
],
|
||||
];
|
||||
}
|
||||
25
Modules/Setting/Providers/SettingServiceProvider.php
Normal file
25
Modules/Setting/Providers/SettingServiceProvider.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Setting\Providers;
|
||||
|
||||
use Modules\Support\Traits\AddsAsset;
|
||||
use Modules\Setting\Admin\SettingTabs;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Modules\Admin\Ui\Facades\TabManager;
|
||||
|
||||
class SettingServiceProvider extends ServiceProvider
|
||||
{
|
||||
use AddsAsset;
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
TabManager::register('settings', SettingTabs::class);
|
||||
|
||||
$this->addAdminAssets('admin.settings.edit', ['admin.setting.js']);
|
||||
}
|
||||
}
|
||||
127
Modules/Setting/Repository.php
Normal file
127
Modules/Setting/Repository.php
Normal file
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Setting;
|
||||
|
||||
use ArrayAccess;
|
||||
use Modules\Setting\Entities\Setting;
|
||||
|
||||
class Repository implements ArrayAccess
|
||||
{
|
||||
/**
|
||||
* Collection of all settings.
|
||||
*
|
||||
* @var \Illuminate\Support\Collection
|
||||
*/
|
||||
private $settings;
|
||||
|
||||
/**
|
||||
* Create a new repository instance.
|
||||
*
|
||||
* @param \Illuminate\Support\Collection $settings
|
||||
*/
|
||||
public function __construct($settings)
|
||||
{
|
||||
$this->settings = $settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all settings.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function all()
|
||||
{
|
||||
return $this->settings->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get setting for the given key.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
public function get($key, $default = null)
|
||||
{
|
||||
return $this->settings->get($key) ?: $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the given settings.
|
||||
*
|
||||
* @param array $settings
|
||||
* @return void
|
||||
*/
|
||||
public function set($settings = [])
|
||||
{
|
||||
Setting::setMany($settings);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if an setting is exists.
|
||||
*
|
||||
* @param string $key
|
||||
* @return bool
|
||||
*/
|
||||
public function offsetExists($key)
|
||||
{
|
||||
return $this->settings->has($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get setting for the given key.
|
||||
*
|
||||
* @param string $key
|
||||
* @return mixed
|
||||
*/
|
||||
public function offsetGet($key)
|
||||
{
|
||||
return $this->get($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a key / value setting pair.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($key, $value)
|
||||
{
|
||||
$this->set([$key => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unset a setting by the given key.
|
||||
*
|
||||
* @param string $key
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function offsetUnset($key)
|
||||
{
|
||||
return $this->settings->forget($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get setting for the given key.
|
||||
*
|
||||
* @param string $key
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($key)
|
||||
{
|
||||
return $this->offsetGet($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a key / value setting pair.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @return void
|
||||
*/
|
||||
public function __set($key, $value)
|
||||
{
|
||||
$this->offsetSet($key, $value);
|
||||
}
|
||||
}
|
||||
112
Modules/Setting/Resources/assets/admin/js/main.js
Normal file
112
Modules/Setting/Resources/assets/admin/js/main.js
Normal file
@@ -0,0 +1,112 @@
|
||||
window.admin.removeSubmitButtonOffsetOn(["#logo", "#courier"]);
|
||||
|
||||
let currencyRateExchangeService = $("#currency_rate_exchange_service");
|
||||
|
||||
$(`#${currencyRateExchangeService.val()}-service`).removeClass("hide");
|
||||
|
||||
currencyRateExchangeService.on("change", (e) => {
|
||||
$(".currency-rate-exchange-service").addClass("hide");
|
||||
|
||||
$(`#${e.currentTarget.value}-service`).removeClass("hide");
|
||||
});
|
||||
|
||||
$("#auto_refresh_currency_rates").on("change", () => {
|
||||
$("#auto-refresh-frequency-field").toggleClass("hide");
|
||||
});
|
||||
|
||||
let smsService = $("#sms_service");
|
||||
|
||||
$(`#${smsService.val()}-service`).removeClass("hide");
|
||||
|
||||
smsService.on("change", (e) => {
|
||||
$(".sms-service").addClass("hide");
|
||||
|
||||
$(`#${e.currentTarget.value}-service`).removeClass("hide");
|
||||
});
|
||||
|
||||
$("#facebook_login_enabled").on("change", () => {
|
||||
$("#facebook-login-fields").toggleClass("hide");
|
||||
});
|
||||
|
||||
$("#google_login_enabled").on("change", () => {
|
||||
$("#google-login-fields").toggleClass("hide");
|
||||
});
|
||||
|
||||
$("#paypal_enabled").on("change", () => {
|
||||
$("#paypal-fields").toggleClass("hide");
|
||||
});
|
||||
|
||||
$("#stripe_enabled").on("change", () => {
|
||||
$("#stripe-fields").toggleClass("hide");
|
||||
});
|
||||
|
||||
$("#paytm_enabled").on("change", () => {
|
||||
$("#paytm-fields").toggleClass("hide");
|
||||
});
|
||||
|
||||
$("#razorpay_enabled").on("change", () => {
|
||||
$("#razorpay-fields").toggleClass("hide");
|
||||
});
|
||||
|
||||
$("#instamojo_enabled").on("change", () => {
|
||||
$("#instamojo-fields").toggleClass("hide");
|
||||
});
|
||||
|
||||
$("#paystack_enabled").on("change", () => {
|
||||
$("#paystack-fields").toggleClass("hide");
|
||||
});
|
||||
|
||||
$("#authorizenet_enabled").on("change", () => {
|
||||
$("#authorizenet-fields").toggleClass("hide");
|
||||
});
|
||||
|
||||
$("#mercadopago_enabled").on("change", () => {
|
||||
$("#mercadopago-fields").toggleClass("hide");
|
||||
});
|
||||
|
||||
$("#flutterwave_enabled").on("change", () => {
|
||||
$("#flutterwave-fields").toggleClass("hide");
|
||||
});
|
||||
|
||||
$("#bank_transfer_enabled").on("change", () => {
|
||||
$("#bank-transfer-fields").toggleClass("hide");
|
||||
});
|
||||
|
||||
$("#check_payment_enabled").on("change", () => {
|
||||
$("#check-payment-fields").toggleClass("hide");
|
||||
});
|
||||
|
||||
$("#store_country").on("change", (e) => {
|
||||
let oldState = $("#store_state").val();
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: route("countries.states.index", e.currentTarget.value),
|
||||
success(states) {
|
||||
$(".store-state").addClass("hide");
|
||||
|
||||
if (_.isEmpty(states)) {
|
||||
return $(".store-state.input")
|
||||
.removeClass("hide")
|
||||
.find("input")
|
||||
.val(oldState);
|
||||
}
|
||||
|
||||
let options = "";
|
||||
|
||||
for (let code in states) {
|
||||
options += `<option value="${code}">${states[code]}</option>`;
|
||||
}
|
||||
|
||||
$(".store-state.select")
|
||||
.removeClass("hide")
|
||||
.find("select")
|
||||
.html(options)
|
||||
.val(oldState);
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
$(function () {
|
||||
$("#store_country").trigger("change");
|
||||
});
|
||||
170
Modules/Setting/Resources/lang/en/attributes.php
Normal file
170
Modules/Setting/Resources/lang/en/attributes.php
Normal file
@@ -0,0 +1,170 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'supported_countries' => 'Supported Countries',
|
||||
'default_country' => 'Default Country',
|
||||
'supported_locales' => 'Supported Locales',
|
||||
|
||||
'default_locale' => 'Default Locale',
|
||||
'default_timezone' => 'Default Timezone',
|
||||
'customer_role' => 'Customer Role',
|
||||
'reviews_enabled' => 'Reviews & Ratings',
|
||||
'auto_approve_reviews' => 'Auto Approve Reviews',
|
||||
'cookie_bar_enabled' => 'Cookie Bar',
|
||||
|
||||
'maintenance_mode' => 'Maintenance Mode',
|
||||
|
||||
'translatable.store_tagline' => 'Store Tagline',
|
||||
'translatable.store_name' => 'Store Name',
|
||||
'store_phone' => 'Store Phone',
|
||||
'store_email' => 'Store Email',
|
||||
'store_address_1' => 'Store Address 1',
|
||||
'store_address_2' => 'Store Address 2',
|
||||
'store_city' => 'Store City',
|
||||
'store_country' => 'Store Country',
|
||||
'store_state' => 'Store State',
|
||||
'store_zip' => 'Store Zip',
|
||||
'store_phone_hide' => 'Hide Store Phone',
|
||||
'store_email_hide' => 'Hide Store Email',
|
||||
|
||||
'supported_currency' => 'Supported Currency',
|
||||
'supported_currencies' => 'Supported Currencies',
|
||||
'default_currency' => 'Default Currency',
|
||||
'currency_rate_exchange_service' => 'Exchange Rate Service',
|
||||
'fixer_access_key' => 'Fixer Access key',
|
||||
'forge_api_key' => 'Forge API key',
|
||||
'currency_data_feed_api_key' => 'Currency Data Feed API Key',
|
||||
'auto_refresh_currency_rates' => 'Auto Refresh',
|
||||
'auto_refresh_currency_rate_frequency' => 'Frequency',
|
||||
|
||||
'sms_from' => 'SMS From',
|
||||
'sms_service' => 'SMS Service',
|
||||
'vonage_key' => 'API Key',
|
||||
'vonage_secret' => 'API Secret',
|
||||
'twilio_sid' => 'Account SID',
|
||||
'twilio_token' => 'Auth Token',
|
||||
'welcome_sms' => 'Welcome SMS',
|
||||
'new_order_admin_sms' => 'New Order Admin SMS',
|
||||
'new_order_sms' => 'New Order SMS',
|
||||
'sms_order_statuses' => 'SMS Order Statuses',
|
||||
|
||||
'mail_from_address' => 'Mail From Address',
|
||||
'mail_from_name' => 'Mail From Name',
|
||||
'mail_host' => 'Mail Host',
|
||||
'mail_port' => 'Mail Port',
|
||||
'mail_username' => 'Mail Username',
|
||||
'mail_password' => 'Mail Password',
|
||||
'mail_encryption' => 'Mail Encryption',
|
||||
'welcome_email' => 'Welcome Email',
|
||||
'admin_order_email' => 'New Order Admin Email',
|
||||
'invoice_email' => 'Invoice Email',
|
||||
'email_order_statuses' => 'Email Order Statuses',
|
||||
|
||||
'newsletter_enabled' => 'Newsletter',
|
||||
'mailchimp_api_key' => 'Mailchimp API Key',
|
||||
'mailchimp_list_id' => 'Mailchimp List ID',
|
||||
|
||||
'custom_header_assets' => 'Header',
|
||||
'custom_footer_assets' => 'Footer',
|
||||
|
||||
'facebook_login_enabled' => 'Status',
|
||||
'facebook_login_app_id' => 'App ID',
|
||||
'facebook_login_app_secret' => 'App Secret',
|
||||
|
||||
'google_login_enabled' => 'Status',
|
||||
'google_login_client_id' => 'Client ID',
|
||||
'google_login_client_secret' => 'Client Secret',
|
||||
|
||||
'free_shipping_enabled' => 'Status',
|
||||
'translatable.free_shipping_label' => 'Label',
|
||||
'free_shipping_min_amount' => 'Minimum Amount',
|
||||
|
||||
'local_pickup_enabled' => 'Status',
|
||||
'translatable.local_pickup_label' => 'Label',
|
||||
'local_pickup_cost' => 'Cost',
|
||||
|
||||
'flat_rate_enabled' => 'Status',
|
||||
'translatable.flat_rate_label' => 'Label',
|
||||
'flat_rate_cost' => 'Cost',
|
||||
|
||||
'paypal_enabled' => 'Status',
|
||||
'translatable.paypal_label' => 'Label',
|
||||
'translatable.paypal_description' => 'Description',
|
||||
'paypal_test_mode' => 'Sandbox',
|
||||
'paypal_client_id' => 'Client ID',
|
||||
'paypal_secret' => 'Secret',
|
||||
|
||||
'stripe_enabled' => 'Status',
|
||||
'translatable.stripe_label' => 'Label',
|
||||
'translatable.stripe_description' => 'Description',
|
||||
'stripe_publishable_key' => 'Publishable Key',
|
||||
'stripe_secret_key' => 'Secret Key',
|
||||
|
||||
'paytm_enabled' => 'Status',
|
||||
'translatable.paytm_label' => 'Label',
|
||||
'translatable.paytm_description' => 'Description',
|
||||
'paytm_test_mode' => 'Sandbox',
|
||||
'paytm_merchant_id' => 'Merchant ID',
|
||||
'paytm_merchant_key' => 'Merchant Key',
|
||||
|
||||
'razorpay_enabled' => 'Status',
|
||||
'razorpay_label' => 'Label',
|
||||
'razorpay_description' => 'Description',
|
||||
'razorpay_key_id' => 'Key Id',
|
||||
'razorpay_key_secret' => 'Key Secret',
|
||||
|
||||
'instamojo_enabled' => 'Status',
|
||||
'instamojo_label' => 'Label',
|
||||
'instamojo_description' => 'Description',
|
||||
'instamojo_test_mode' => 'Sandbox',
|
||||
'instamojo_api_key' => 'API Key',
|
||||
'instamojo_auth_token' => 'Auth Token',
|
||||
|
||||
'paystack_enabled' => 'Status',
|
||||
'translatable.paystack_label' => 'Label',
|
||||
'translatable.paystack_description' => 'Description',
|
||||
'paystack_test_mode' => 'Sandbox',
|
||||
'paystack_public_key' => 'Public Key',
|
||||
'paystack_secret_key' => 'Secret Key',
|
||||
|
||||
'authorizenet_enabled' => 'Status',
|
||||
'authorizenet_label' => 'Label',
|
||||
'authorizenet_description' => 'Description',
|
||||
'authorizenet_test_mode' => 'Sandbox',
|
||||
'authorizenet_merchant_login_id' => 'Merchant Login ID',
|
||||
'authorizenet_merchant_transaction_key' => 'Merchant Transaction Key',
|
||||
|
||||
'mercadopago_enabled' => 'Status',
|
||||
'mercadopago_label' => 'Label',
|
||||
'mercadopago_description' => 'Description',
|
||||
'mercadopago_test_mode' => 'Sandbox',
|
||||
'mercadopago_public_key' => 'Public Key',
|
||||
'mercadopago_access_token' => 'Access Token',
|
||||
|
||||
'flutterwave_enabled' => 'Status',
|
||||
'flutterwave_label' => 'Label',
|
||||
'flutterwave_description' => 'Description',
|
||||
'flutterwave_test_mode' => 'Sandbox',
|
||||
'flutterwave_public_key' => 'Public Key',
|
||||
'flutterwave_secret_key' => 'Secret Key',
|
||||
'flutterwave_encryption_key' => 'Encryption Key',
|
||||
|
||||
'cod_enabled' => 'Status',
|
||||
'translatable.cod_label' => 'Label',
|
||||
'translatable.cod_description' => 'Description',
|
||||
|
||||
'bank_transfer_enabled' => 'Status',
|
||||
'translatable.bank_transfer_label' => 'Label',
|
||||
'translatable.bank_transfer_description' => 'Description',
|
||||
'translatable.bank_transfer_instructions' => 'Instructions',
|
||||
|
||||
'check_payment_enabled' => 'Status',
|
||||
'translatable.check_payment_label' => 'Label',
|
||||
'translatable.check_payment_description' => 'Description',
|
||||
'translatable.check_payment_instructions' => 'Instructions',
|
||||
|
||||
// validation
|
||||
'supported_countries.*' => 'Supported Countries',
|
||||
'supported_locales.*' => 'Supported Locales',
|
||||
'supported_currencies.*' => 'Supported Currencies',
|
||||
];
|
||||
5
Modules/Setting/Resources/lang/en/messages.php
Normal file
5
Modules/Setting/Resources/lang/en/messages.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'settings_have_been_saved' => 'Settings have been saved.',
|
||||
];
|
||||
5
Modules/Setting/Resources/lang/en/permissions.php
Normal file
5
Modules/Setting/Resources/lang/en/permissions.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'edit' => 'Edit Settings',
|
||||
];
|
||||
88
Modules/Setting/Resources/lang/en/settings.php
Normal file
88
Modules/Setting/Resources/lang/en/settings.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'settings' => 'Settings',
|
||||
'tabs' => [
|
||||
'group' => [
|
||||
'general_settings' => 'General Settings',
|
||||
'social_logins' => 'Social Logins',
|
||||
'shipping_methods' => 'Shipping Methods',
|
||||
'payment_methods' => 'Payment Methods',
|
||||
],
|
||||
'general' => 'General',
|
||||
'maintenance' => 'Maintenance',
|
||||
'store' => 'Store',
|
||||
'currency' => 'Currency',
|
||||
'sms' => 'SMS',
|
||||
'mail' => 'Mail',
|
||||
'newsletter' => 'Newsletter',
|
||||
'custom_css_js' => 'Custom CSS/JS',
|
||||
'facebook' => 'Facebook',
|
||||
'google' => 'Google',
|
||||
'free_shipping' => 'Free Shipping',
|
||||
'local_pickup' => 'Local Pickup',
|
||||
'flat_rate' => 'Flat Rate',
|
||||
'paypal' => 'PayPal',
|
||||
'stripe' => 'Stripe',
|
||||
'paytm' => 'Paytm',
|
||||
'razorpay' => 'Razorpay',
|
||||
'instamojo' => 'Instamojo',
|
||||
'paystack' => 'Paystack',
|
||||
'authorizenet' => 'Authorize.net',
|
||||
'mercadopago' => 'Mercado Pago',
|
||||
'flutterwave' => 'Flutterwave',
|
||||
'cod' => 'Cash On Delivery',
|
||||
'bank_transfer' => 'Bank Transfer',
|
||||
'check_payment' => 'Check / Money Order',
|
||||
],
|
||||
'form' => [
|
||||
'allow_reviews' => 'Allow customers to give reviews & ratings',
|
||||
'approve_reviews_automatically' => 'Customer reviews will be approved automatically',
|
||||
'show_cookie_bar' => 'Show cookie bar in your website',
|
||||
'privacy_settings' => 'Privacy Settings',
|
||||
'hide_store_phone' => 'Hide store phone from the storefront',
|
||||
'hide_store_email' => 'Hide store email from the storefront',
|
||||
'put_the_application_into_maintenance_mode' => 'Put the application into maintenance mode',
|
||||
'ip_addreses_seperated_in_new_line' => 'IP addreses seperated in new line',
|
||||
'select_service' => 'Select Service',
|
||||
'enable_auto_refreshing_currency_rates' => 'Enable auto-refreshing currency rates',
|
||||
'auto_refresh_currency_rate_frequencies' => [
|
||||
'daily' => 'Daily',
|
||||
'weekly' => 'Weekly',
|
||||
'monthly' => 'Monthly',
|
||||
],
|
||||
'customer_notification_settings' => 'Customer Notification Settings',
|
||||
'send_welcome_sms_after_registration' => 'Send welcome SMS after registration',
|
||||
'order_notification_settings' => 'Order Notification Settings',
|
||||
'send_new_order_notification_to_customer' => 'Send new order notification to the customer',
|
||||
'send_new_order_notification_to_admin' => 'Send new order notification to the admin',
|
||||
'mail_encryption_protocols' => [
|
||||
'ssl' => 'SSL',
|
||||
'tls' => 'Tls',
|
||||
],
|
||||
'send_welcome_email_after_registration' => 'Send welcome email after registration',
|
||||
'send_invoice_email' => 'Send invoice email to the customer after checkout',
|
||||
'allow_customers_to_subscribe' => 'Allow customers to subscribe to your newsletter.',
|
||||
'enable_facebook_login' => 'Enable Facebook Login',
|
||||
'enable_google_login' => 'Enable Google Login',
|
||||
'enable_free_shipping' => 'Enable Free Shipping',
|
||||
'enable_local_pickup' => 'Enable Local Pickup',
|
||||
'enable_flat_rate' => 'Enable Flat Rate',
|
||||
'enable_paypal' => 'Enable PayPal',
|
||||
'use_sandbox_for_test_payments' => 'Use sandbox for test payments',
|
||||
'enable_stripe' => 'Enable Stripe',
|
||||
'enable_paytm' => 'Enable Paytm',
|
||||
'enable_razorpay' => 'Enable Razorpay',
|
||||
'enable_instamojo' => 'Enable Instamojo',
|
||||
'enable_paystack' => 'Enable Paystack',
|
||||
'enable_authorizenet' => 'Enable Authorize.net',
|
||||
'enable_mercadopago' => 'Enable Mercado Pago',
|
||||
'enable_flutterwave' => 'Enable Flutterwave',
|
||||
'enable_cod' => 'Enable Cash On Delivery',
|
||||
'enable_bank_transfer' => 'Enable Bank Transfer',
|
||||
'enable_check_payment' => 'Enable Check / Money Order',
|
||||
],
|
||||
'validation' => [
|
||||
'sqlite_is_not_installed' => 'SQLite is not installed.',
|
||||
],
|
||||
];
|
||||
6
Modules/Setting/Resources/lang/en/sidebar.php
Normal file
6
Modules/Setting/Resources/lang/en/sidebar.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'settings' => 'Settings',
|
||||
'general' => 'General',
|
||||
];
|
||||
@@ -0,0 +1,21 @@
|
||||
@extends('admin::layout')
|
||||
|
||||
@section('title', trans('setting::settings.settings'))
|
||||
|
||||
@section('content_header')
|
||||
<h3>{{ trans('setting::settings.settings') }}</h3>
|
||||
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('admin.dashboard.index') }}">{{ trans('admin::dashboard.dashboard') }}</a></li>
|
||||
<li class="active">{{ trans('setting::settings.settings') }}</li>
|
||||
</ol>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<form method="POST" action="{{ route('admin.settings.update') }}" class="form-horizontal" id="settings-edit-form" novalidate>
|
||||
{{ csrf_field() }}
|
||||
{{ method_field('put') }}
|
||||
|
||||
{!! $tabs->render(compact('settings')) !!}
|
||||
</form>
|
||||
@endsection
|
||||
@@ -0,0 +1 @@
|
||||
{{ Form::password('currency_data_feed_api_key', trans('setting::attributes.currency_data_feed_api_key'), $errors, $settings, ['required' => true]) }}
|
||||
@@ -0,0 +1 @@
|
||||
{{ Form::password('fixer_access_key', trans('setting::attributes.fixer_access_key'), $errors, $settings, ['required' => true]) }}
|
||||
@@ -0,0 +1 @@
|
||||
{{ Form::password('forge_api_key', trans('setting::attributes.forge_api_key'), $errors, $settings, ['required' => true]) }}
|
||||
@@ -0,0 +1,2 @@
|
||||
{{ Form::text('twilio_sid', trans('setting::attributes.twilio_sid'), $errors, $settings, ['required' => true]) }}
|
||||
{{ Form::password('twilio_token', trans('setting::attributes.twilio_token'), $errors, $settings, ['required' => true]) }}
|
||||
@@ -0,0 +1,2 @@
|
||||
{{ Form::text('vonage_key', trans('setting::attributes.vonage_key'), $errors, $settings, ['required' => true]) }}
|
||||
{{ Form::password('vonage_secret', trans('setting::attributes.vonage_secret'), $errors, $settings, ['required' => true]) }}
|
||||
@@ -0,0 +1,14 @@
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
{{ Form::checkbox('authorizenet_enabled', trans('setting::attributes.authorizenet_enabled'), trans('setting::settings.form.enable_authorizenet'), $errors, $settings) }}
|
||||
{{ Form::text('translatable[authorizenet_label]', trans('setting::attributes.authorizenet_label'), $errors, $settings, ['required' => true]) }}
|
||||
{{ Form::textarea('translatable[authorizenet_description]', trans('setting::attributes.authorizenet_description'), $errors, $settings, ['rows' => 3, 'required' => true]) }}
|
||||
{{ Form::checkbox('authorizenet_test_mode', trans('setting::attributes.authorizenet_test_mode'), trans('setting::settings.form.use_sandbox_for_test_payments'), $errors, $settings) }}
|
||||
|
||||
<div class="{{ old('authorizenet_enabled', array_get($settings, 'authorizenet_enabled')) ? '' : 'hide' }}"
|
||||
id="authorizenet-fields">
|
||||
{{ Form::text('authorizenet_merchant_login_id', trans('setting::attributes.authorizenet_merchant_login_id'), $errors, $settings, ['required' => true]) }}
|
||||
{{ Form::text('authorizenet_merchant_transaction_key', trans('setting::attributes.authorizenet_merchant_transaction_key'), $errors, $settings, ['required' => true]) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,11 @@
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
{{ Form::checkbox('bank_transfer_enabled', trans('setting::attributes.bank_transfer_enabled'), trans('setting::settings.form.enable_bank_transfer'), $errors, $settings) }}
|
||||
{{ Form::text('translatable[bank_transfer_label]', trans('setting::attributes.translatable.bank_transfer_label'), $errors, $settings, ['required' => true]) }}
|
||||
{{ Form::textarea('translatable[bank_transfer_description]', trans('setting::attributes.translatable.bank_transfer_description'), $errors, $settings, ['rows' => 3, 'required' => true]) }}
|
||||
|
||||
<div class="{{ old('bank_transfer_enabled', array_get($settings, 'bank_transfer_enabled')) ? '' : 'hide' }}" id="bank-transfer-fields">
|
||||
{{ Form::textarea('translatable[bank_transfer_instructions]', trans('setting::attributes.translatable.bank_transfer_instructions'), $errors, $settings, ['rows' => 3, 'required' => true]) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,11 @@
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
{{ Form::checkbox('check_payment_enabled', trans('setting::attributes.check_payment_enabled'), trans('setting::settings.form.enable_check_payment'), $errors, $settings) }}
|
||||
{{ Form::text('translatable[check_payment_label]', trans('setting::attributes.translatable.check_payment_label'), $errors, $settings, ['required' => true]) }}
|
||||
{{ Form::textarea('translatable[check_payment_description]', trans('setting::attributes.translatable.check_payment_description'), $errors, $settings, ['rows' => 3, 'required' => true]) }}
|
||||
|
||||
<div class="{{ old('check_payment_enabled', array_get($settings, 'check_payment_enabled')) ? '' : 'hide' }}" id="check-payment-fields">
|
||||
{{ Form::textarea('translatable[check_payment_instructions]', trans('setting::attributes.translatable.check_payment_instructions'), $errors, $settings, ['rows' => 3, 'required' => true]) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,7 @@
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
{{ Form::checkbox('cod_enabled', trans('setting::attributes.cod_enabled'), trans('setting::settings.form.enable_cod'), $errors, $settings) }}
|
||||
{{ Form::text('translatable[cod_label]', trans('setting::attributes.translatable.cod_label'), $errors, $settings, ['required' => true]) }}
|
||||
{{ Form::textarea('translatable[cod_description]', trans('setting::attributes.translatable.cod_description'), $errors, $settings, ['rows' => 3, 'required' => true]) }}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,19 @@
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
{{ Form::select('supported_currencies', trans('setting::attributes.supported_currencies'), $errors, $currencies, $settings, ['class' => 'selectize prevent-creation', 'required' => true, 'multiple' => true]) }}
|
||||
{{ Form::select('default_currency', trans('setting::attributes.default_currency'), $errors, $currencies, $settings, ['required' => true]) }}
|
||||
{{ Form::select('currency_rate_exchange_service', trans('setting::attributes.currency_rate_exchange_service'), $errors, $currencyRateExchangeServices, $settings) }}
|
||||
|
||||
@foreach ($currencyRateExchangeServices as $service => $serviceName)
|
||||
<div class="currency-rate-exchange-service hide" id="{{ $service }}-service">
|
||||
@includeIf("setting::admin.settings.partials.currency_rate_exchange_services.{$service}")
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
{{ Form::checkbox('auto_refresh_currency_rates', trans('setting::attributes.auto_refresh_currency_rates'), trans('setting::settings.form.enable_auto_refreshing_currency_rates'), $errors, $settings) }}
|
||||
|
||||
<div class="{{ old('auto_refresh_currency_rates', array_get($settings, 'auto_refresh_currency_rates')) ? '' : 'hide' }}" id="auto-refresh-frequency-field">
|
||||
{{ Form::select('auto_refresh_currency_rate_frequency', trans('setting::attributes.auto_refresh_currency_rate_frequency'), $errors, trans('setting::settings.form.auto_refresh_currency_rate_frequencies'), $settings, ['required' => true]) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,6 @@
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
{{ Form::textarea('custom_header_assets', trans('setting::attributes.custom_header_assets'), $errors, $settings) }}
|
||||
{{ Form::textarea('custom_footer_assets', trans('setting::attributes.custom_footer_assets'), $errors, $settings) }}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,10 @@
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
{{ Form::checkbox('facebook_login_enabled', trans('setting::attributes.facebook_login_enabled'), trans('setting::settings.form.enable_facebook_login'), $errors, $settings) }}
|
||||
|
||||
<div class="{{ old('facebook_login_enabled', array_get($settings, 'facebook_login_enabled')) ? '' : 'hide' }}" id="facebook-login-fields">
|
||||
{{ Form::text('facebook_login_app_id', trans('setting::attributes.facebook_login_app_id'), $errors, $settings, ['required' => true]) }}
|
||||
{{ Form::password('facebook_login_app_secret', trans('setting::attributes.facebook_login_app_secret'), $errors, $settings, ['required' => true]) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,7 @@
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
{{ Form::checkbox('flat_rate_enabled', trans('setting::attributes.flat_rate_enabled'), trans('setting::settings.form.enable_flat_rate'), $errors, $settings) }}
|
||||
{{ Form::text('translatable[flat_rate_label]', trans('setting::attributes.translatable.flat_rate_label'), $errors, $settings, ['required' => true]) }}
|
||||
{{ Form::number('flat_rate_cost', trans('setting::attributes.flat_rate_cost'), $errors, $settings, ['min' => 0, 'required' => true]) }}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,14 @@
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
{{ Form::checkbox('flutterwave_enabled', trans('setting::attributes.flutterwave_enabled'), trans('setting::settings.form.enable_flutterwave'), $errors, $settings) }}
|
||||
{{ Form::text('translatable[flutterwave_label]', trans('setting::attributes.flutterwave_label'), $errors, $settings, ['required' => true]) }}
|
||||
{{ Form::textarea('translatable[flutterwave_description]', trans('setting::attributes.flutterwave_description'), $errors, $settings, ['rows' => 3, 'required' => true]) }}
|
||||
{{ Form::checkbox('flutterwave_test_mode', trans('setting::attributes.flutterwave_test_mode'), trans('setting::settings.form.use_sandbox_for_test_payments'), $errors, $settings) }}
|
||||
|
||||
<div class="{{ old('flutterwave_enabled', array_get($settings, 'flutterwave_enabled')) ? '' : 'hide' }}" id="flutterwave-fields">
|
||||
{{ Form::text('flutterwave_public_key', trans('setting::attributes.flutterwave_public_key'), $errors, $settings, ['required' => true]) }}
|
||||
{{ Form::password('flutterwave_secret_key', trans('setting::attributes.flutterwave_secret_key'), $errors, $settings, ['required' => true]) }}
|
||||
{{ Form::password('flutterwave_encryption_key', trans('setting::attributes.flutterwave_encryption_key'), $errors, $settings, ['required' => true]) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,7 @@
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
{{ Form::checkbox('free_shipping_enabled', trans('setting::attributes.free_shipping_enabled'), trans('setting::settings.form.enable_free_shipping'), $errors, $settings) }}
|
||||
{{ Form::text('translatable[free_shipping_label]', trans('setting::attributes.translatable.free_shipping_label'), $errors, $settings, ['required' => true]) }}
|
||||
{{ Form::number('free_shipping_min_amount', trans('setting::attributes.free_shipping_min_amount'), $errors, $settings) }}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,13 @@
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
{{ Form::select('supported_countries', trans('setting::attributes.supported_countries'), $errors, $countries, $settings, ['class' => 'selectize prevent-creation', 'required' => true, 'multiple' => true]) }}
|
||||
{{ Form::select('default_country', trans('setting::attributes.default_country'), $errors, $countries, $settings, ['required' => true]) }}
|
||||
{{ Form::select('supported_locales', trans('setting::attributes.supported_locales'), $errors, $locales, $settings, ['class' => 'selectize prevent-creation', 'required' => true, 'multiple' => true]) }}
|
||||
{{ Form::select('default_locale', trans('setting::attributes.default_locale'), $errors, $locales, $settings, ['required' => true]) }}
|
||||
{{ Form::select('default_timezone', trans('setting::attributes.default_timezone'), $errors, $timeZones, $settings, ['required' => true]) }}
|
||||
{{ Form::select('customer_role', trans('setting::attributes.customer_role'), $errors, $roles, $settings, ['required' => true]) }}
|
||||
{{ Form::checkbox('reviews_enabled', trans('setting::attributes.reviews_enabled'), trans('setting::settings.form.allow_reviews'), $errors, $settings) }}
|
||||
{{ Form::checkbox('auto_approve_reviews', trans('setting::attributes.auto_approve_reviews'), trans('setting::settings.form.approve_reviews_automatically'), $errors, $settings) }}
|
||||
{{ Form::checkbox('cookie_bar_enabled', trans('setting::attributes.cookie_bar_enabled'), trans('setting::settings.form.show_cookie_bar'), $errors, $settings) }}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,10 @@
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
{{ Form::checkbox('google_login_enabled', trans('setting::attributes.google_login_enabled'), trans('setting::settings.form.enable_google_login'), $errors, $settings) }}
|
||||
|
||||
<div class="{{ old('google_login_enabled', array_get($settings, 'google_login_enabled')) ? '' : 'hide' }}" id="google-login-fields">
|
||||
{{ Form::text('google_login_client_id', trans('setting::attributes.google_login_client_id'), $errors, $settings, ['required' => true]) }}
|
||||
{{ Form::password('google_login_client_secret', trans('setting::attributes.google_login_client_secret'), $errors, $settings, ['required' => true]) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,13 @@
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
{{ Form::checkbox('instamojo_enabled', trans('setting::attributes.instamojo_enabled'), trans('setting::settings.form.enable_instamojo'), $errors, $settings) }}
|
||||
{{ Form::text('translatable[instamojo_label]', trans('setting::attributes.instamojo_label'), $errors, $settings, ['required' => true]) }}
|
||||
{{ Form::textarea('translatable[instamojo_description]', trans('setting::attributes.instamojo_description'), $errors, $settings, ['rows' => 3, 'required' => true]) }}
|
||||
{{ Form::checkbox('instamojo_test_mode', trans('setting::attributes.instamojo_test_mode'), trans('setting::settings.form.use_sandbox_for_test_payments'), $errors, $settings) }}
|
||||
|
||||
<div class="{{ old('instamojo_enabled', array_get($settings, 'instamojo_enabled')) ? '' : 'hide' }}" id="instamojo-fields">
|
||||
{{ Form::text('instamojo_api_key', trans('setting::attributes.instamojo_api_key'), $errors, $settings, ['required' => true]) }}
|
||||
{{ Form::password('instamojo_auth_token', trans('setting::attributes.instamojo_auth_token'), $errors, $settings, ['required' => true]) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,7 @@
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
{{ Form::checkbox('local_pickup_enabled', trans('setting::attributes.local_pickup_enabled'), trans('setting::settings.form.enable_local_pickup'), $errors, $settings) }}
|
||||
{{ Form::text('translatable[local_pickup_label]', trans('setting::attributes.translatable.local_pickup_label'), $errors, $settings, ['required' => true]) }}
|
||||
{{ Form::number('local_pickup_cost', trans('setting::attributes.local_pickup_cost'), $errors, $settings, ['min' => 0, 'required' => true]) }}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,27 @@
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="box-content clearfix">
|
||||
{{ Form::text('mail_from_address', trans('setting::attributes.mail_from_address'), $errors, $settings) }}
|
||||
{{ Form::text('mail_from_name', trans('setting::attributes.mail_from_name'), $errors, $settings) }}
|
||||
{{ Form::text('mail_host', trans('setting::attributes.mail_host'), $errors, $settings) }}
|
||||
{{ Form::text('mail_port', trans('setting::attributes.mail_port'), $errors, $settings) }}
|
||||
{{ Form::text('mail_username', trans('setting::attributes.mail_username'), $errors, $settings) }}
|
||||
{{ Form::password('mail_password', trans('setting::attributes.mail_password'), $errors, $settings) }}
|
||||
{{ Form::select('mail_encryption', trans('setting::attributes.mail_encryption'), $errors, $encryptionProtocols, $settings) }}
|
||||
</div>
|
||||
|
||||
<div class="box-content clearfix">
|
||||
<h4 class="section-title">{{ trans('setting::settings.form.customer_notification_settings') }}</h4>
|
||||
|
||||
{{ Form::checkbox('welcome_email', trans('setting::attributes.welcome_email'), trans('setting::settings.form.send_welcome_email_after_registration'), $errors, $settings) }}
|
||||
</div>
|
||||
|
||||
<div class="box-content clearfix">
|
||||
<h4 class="section-title">{{ trans('setting::settings.form.order_notification_settings') }}</h4>
|
||||
|
||||
{{ Form::checkbox('admin_order_email', trans('setting::attributes.admin_order_email'), trans('setting::settings.form.send_new_order_notification_to_admin'), $errors, $settings) }}
|
||||
{{ Form::checkbox('invoice_email', trans('setting::attributes.invoice_email'), trans('setting::settings.form.send_invoice_email'), $errors, $settings) }}
|
||||
{{ Form::select('email_order_statuses', trans('setting::attributes.email_order_statuses'), $errors, $orderStatuses, $settings, ['class' => 'selectize prevent-creation', 'multiple' => true]) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,5 @@
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
{{ Form::checkbox('maintenance_mode', trans('setting::attributes.maintenance_mode'), trans('setting::settings.form.put_the_application_into_maintenance_mode'), $errors, $settings) }}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,15 @@
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
{{ Form::checkbox('mercadopago_enabled', trans('setting::attributes.mercadopago_enabled'), trans('setting::settings.form.enable_mercadopago'), $errors, $settings) }}
|
||||
{{ Form::text('translatable[mercadopago_label]', trans('setting::attributes.mercadopago_label'), $errors, $settings, ['required' => true]) }}
|
||||
{{ Form::textarea('translatable[mercadopago_description]', trans('setting::attributes.mercadopago_description'), $errors, $settings, ['rows' => 3, 'required' => true]) }}
|
||||
{{ Form::checkbox('mercadopago_test_mode', trans('setting::attributes.mercadopago_test_mode'), trans('setting::settings.form.use_sandbox_for_test_payments'), $errors, $settings) }}
|
||||
|
||||
<div class="{{ old('mercadopago_enabled', array_get($settings, 'mercadopago_enabled')) ? '' : 'hide' }}"
|
||||
id="mercadopago-fields">
|
||||
{{ Form::select('mercadopago_supported_currency', trans('setting::attributes.supported_currency'), $errors, $currencies, $settings, ['required' => true]) }}
|
||||
{{ Form::text('mercadopago_public_key', trans('setting::attributes.mercadopago_public_key'), $errors, $settings, ['required' => true]) }}
|
||||
{{ Form::password('mercadopago_access_token', trans('setting::attributes.mercadopago_access_token'), $errors, $settings, ['required' => true]) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,7 @@
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
{{ Form::checkbox('newsletter_enabled', trans('setting::attributes.newsletter_enabled'), trans('setting::settings.form.allow_customers_to_subscribe'), $errors, $settings) }}
|
||||
{{ Form::password('mailchimp_api_key', trans('setting::attributes.mailchimp_api_key'), $errors, $settings) }}
|
||||
{{ Form::text('mailchimp_list_id', trans('setting::attributes.mailchimp_list_id'), $errors, $settings) }}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,13 @@
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
{{ Form::checkbox('paypal_enabled', trans('setting::attributes.paypal_enabled'), trans('setting::settings.form.enable_paypal'), $errors, $settings) }}
|
||||
{{ Form::text('translatable[paypal_label]', trans('setting::attributes.translatable.paypal_label'), $errors, $settings, ['required' => true]) }}
|
||||
{{ Form::textarea('translatable[paypal_description]', trans('setting::attributes.translatable.paypal_description'), $errors, $settings, ['rows' => 3, 'required' => true]) }}
|
||||
{{ Form::checkbox('paypal_test_mode', trans('setting::attributes.paypal_test_mode'), trans('setting::settings.form.use_sandbox_for_test_payments'), $errors, $settings) }}
|
||||
|
||||
<div class="{{ old('paypal_enabled', array_get($settings, 'paypal_enabled')) ? '' : 'hide' }}" id="paypal-fields">
|
||||
{{ Form::text('paypal_client_id', trans('setting::attributes.paypal_client_id'), $errors, $settings, ['required' => true]) }}
|
||||
{{ Form::password('paypal_secret', trans('setting::attributes.paypal_secret'), $errors, $settings, ['required' => true]) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,13 @@
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
{{ Form::checkbox('paystack_enabled', trans('setting::attributes.paystack_enabled'), trans('setting::settings.form.enable_paystack'), $errors, $settings) }}
|
||||
{{ Form::text('translatable[paystack_label]', trans('setting::attributes.translatable.paystack_label'), $errors, $settings, ['required' => true]) }}
|
||||
{{ Form::textarea('translatable[paystack_description]', trans('setting::attributes.translatable.paystack_description'), $errors, $settings, ['rows' => 3, 'required' => true]) }}
|
||||
{{ Form::checkbox('paystack_test_mode', trans('setting::attributes.paystack_test_mode'), trans('setting::settings.form.use_sandbox_for_test_payments'), $errors, $settings) }}
|
||||
|
||||
<div class="{{ old('paystack_enabled', array_get($settings, 'paystack_enabled')) ? '' : 'hide' }}" id="paystack-fields">
|
||||
{{ Form::text('paystack_public_key', trans('setting::attributes.paystack_public_key'), $errors, $settings, ['required' => true]) }}
|
||||
{{ Form::password('paystack_secret_key', trans('setting::attributes.paystack_secret_key'), $errors, $settings, ['required' => true]) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,13 @@
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
{{ Form::checkbox('paytm_enabled', trans('setting::attributes.paytm_enabled'), trans('setting::settings.form.enable_paytm'), $errors, $settings) }}
|
||||
{{ Form::text('translatable[paytm_label]', trans('setting::attributes.translatable.paytm_label'), $errors, $settings, ['required' => true]) }}
|
||||
{{ Form::textarea('translatable[paytm_description]', trans('setting::attributes.translatable.paytm_description'), $errors, $settings, ['rows' => 3, 'required' => true]) }}
|
||||
{{ Form::checkbox('paytm_test_mode', trans('setting::attributes.paytm_test_mode'), trans('setting::settings.form.use_sandbox_for_test_payments'), $errors, $settings) }}
|
||||
|
||||
<div class="{{ old('paytm_enabled', array_get($settings, 'paytm_enabled')) ? '' : 'hide' }}" id="paytm-fields">
|
||||
{{ Form::text('paytm_merchant_id', trans('setting::attributes.paytm_merchant_id'), $errors, $settings, ['required' => true]) }}
|
||||
{{ Form::password('paytm_merchant_key', trans('setting::attributes.paytm_merchant_key'), $errors, $settings, ['required' => true]) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,12 @@
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
{{ Form::checkbox('razorpay_enabled', trans('setting::attributes.razorpay_enabled'), trans('setting::settings.form.enable_razorpay'), $errors, $settings) }}
|
||||
{{ Form::text('translatable[razorpay_label]', trans('setting::attributes.razorpay_label'), $errors, $settings, ['required' => true]) }}
|
||||
{{ Form::textarea('translatable[razorpay_description]', trans('setting::attributes.razorpay_description'), $errors, $settings, ['rows' => 3, 'required' => true]) }}
|
||||
|
||||
<div class="{{ old('razorpay_enabled', array_get($settings, 'razorpay_enabled')) ? '' : 'hide' }}" id="razorpay-fields">
|
||||
{{ Form::text('razorpay_key_id', trans('setting::attributes.razorpay_key_id'), $errors, $settings, ['required' => true]) }}
|
||||
{{ Form::password('razorpay_key_secret', trans('setting::attributes.razorpay_key_secret'), $errors, $settings, ['required' => true]) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,28 @@
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="box-content clearfix">
|
||||
{{ Form::text('sms_from', trans('setting::attributes.sms_from'), $errors, $settings) }}
|
||||
{{ Form::select('sms_service', trans('setting::attributes.sms_service'), $errors, $smsServices, $settings) }}
|
||||
|
||||
@foreach ($smsServices as $service => $serviceName)
|
||||
<div class="sms-service hide" id="{{ $service }}-service">
|
||||
@includeIf("setting::admin.settings.partials.sms_services.{$service}")
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
<div class="box-content clearfix">
|
||||
<h4 class="section-title">{{ trans('setting::settings.form.customer_notification_settings') }}</h4>
|
||||
|
||||
{{ Form::checkbox('welcome_sms', trans('setting::attributes.welcome_sms'), trans('setting::settings.form.send_welcome_sms_after_registration'), $errors, $settings) }}
|
||||
</div>
|
||||
|
||||
<div class="box-content clearfix">
|
||||
<h4 class="section-title">{{ trans('setting::settings.form.order_notification_settings') }}</h4>
|
||||
|
||||
{{ Form::checkbox('new_order_admin_sms', trans('setting::attributes.new_order_admin_sms'), trans('setting::settings.form.send_new_order_notification_to_admin'), $errors, $settings) }}
|
||||
{{ Form::checkbox('new_order_sms', trans('setting::attributes.new_order_sms'), trans('setting::settings.form.send_new_order_notification_to_customer'), $errors, $settings) }}
|
||||
{{ Form::select('sms_order_statuses', trans('setting::attributes.sms_order_statuses'), $errors, $orderStatuses, $settings, ['class' => 'selectize prevent-creation', 'multiple' => true]) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,31 @@
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="box-content clearfix">
|
||||
{{ Form::text('translatable[store_name]', trans('setting::attributes.translatable.store_name'), $errors, $settings, ['required' => true]) }}
|
||||
{{ Form::text('translatable[store_tagline]', trans('setting::attributes.translatable.store_tagline'), $errors, $settings, ['rows' => 2]) }}
|
||||
{{ Form::text('store_email', trans('setting::attributes.store_email'), $errors, $settings, ['required' => true]) }}
|
||||
{{ Form::text('store_phone', trans('setting::attributes.store_phone'), $errors, $settings, ['required' => true]) }}
|
||||
{{ Form::text('store_address_1', trans('setting::attributes.store_address_1'), $errors, $settings) }}
|
||||
{{ Form::text('store_address_2', trans('setting::attributes.store_address_2'), $errors, $settings) }}
|
||||
{{ Form::text('store_city', trans('setting::attributes.store_city'), $errors, $settings) }}
|
||||
{{ Form::select('store_country', trans('setting::attributes.store_country'), $errors, $countries, $settings) }}
|
||||
|
||||
<div class="store-state input">
|
||||
{{ Form::text('store_state', trans('setting::attributes.store_state'), $errors, $settings) }}
|
||||
</div>
|
||||
|
||||
<div class="store-state select hide">
|
||||
{{ Form::select('store_state', trans('setting::attributes.store_state'), $errors, [], $settings) }}
|
||||
</div>
|
||||
|
||||
{{ Form::text('store_zip', trans('setting::attributes.store_zip'), $errors, $settings) }}
|
||||
</div>
|
||||
|
||||
<div class="box-content clearfix">
|
||||
<h4 class="section-title">{{ trans('setting::settings.form.privacy_settings') }}</h4>
|
||||
|
||||
{{ Form::checkbox('store_phone_hide', trans('setting::attributes.store_phone_hide'), trans('setting::settings.form.hide_store_phone'), $errors, $settings) }}
|
||||
{{ Form::checkbox('store_email_hide', trans('setting::attributes.store_email_hide'), trans('setting::settings.form.hide_store_email'), $errors, $settings) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,12 @@
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
{{ Form::checkbox('stripe_enabled', trans('setting::attributes.stripe_enabled'), trans('setting::settings.form.enable_stripe'), $errors, $settings) }}
|
||||
{{ Form::text('translatable[stripe_label]', trans('setting::attributes.translatable.stripe_label'), $errors, $settings, ['required' => true]) }}
|
||||
{{ Form::textarea('translatable[stripe_description]', trans('setting::attributes.translatable.stripe_description'), $errors, $settings, ['rows' => 3, 'required' => true]) }}
|
||||
|
||||
<div class="{{ old('stripe_enabled', array_get($settings, 'stripe_enabled')) ? '' : 'hide' }}" id="stripe-fields">
|
||||
{{ Form::text('stripe_publishable_key', trans('setting::attributes.stripe_publishable_key'), $errors, $settings, ['required' => true]) }}
|
||||
{{ Form::password('stripe_secret_key', trans('setting::attributes.stripe_secret_key'), $errors, $settings, ['required' => true]) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
15
Modules/Setting/Routes/admin.php
Normal file
15
Modules/Setting/Routes/admin.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::get('settings', [
|
||||
'as' => 'admin.settings.edit',
|
||||
'uses' => 'SettingController@edit',
|
||||
'middleware' => 'can:admin.settings.edit',
|
||||
]);
|
||||
|
||||
Route::put('settings', [
|
||||
'as' => 'admin.settings.update',
|
||||
'uses' => 'SettingController@update',
|
||||
'middleware' => 'can:admin.settings.edit',
|
||||
]);
|
||||
25
Modules/Setting/Sidebar/SidebarExtender.php
Normal file
25
Modules/Setting/Sidebar/SidebarExtender.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Setting\Sidebar;
|
||||
|
||||
use Maatwebsite\Sidebar\Item;
|
||||
use Maatwebsite\Sidebar\Menu;
|
||||
use Maatwebsite\Sidebar\Group;
|
||||
use Modules\Admin\Sidebar\BaseSidebarExtender;
|
||||
|
||||
class SidebarExtender extends BaseSidebarExtender
|
||||
{
|
||||
public function extend(Menu $menu)
|
||||
{
|
||||
$menu->group(trans('admin::sidebar.system'), function (Group $group) {
|
||||
$group->item(trans('setting::sidebar.settings'), function (Item $item) {
|
||||
$item->weight(25);
|
||||
$item->icon('fa fa-cogs');
|
||||
$item->route('admin.settings.edit');
|
||||
$item->authorize(
|
||||
$this->auth->hasAccess('admin.settings.edit')
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
27
Modules/Setting/composer.json
Normal file
27
Modules/Setting/composer.json
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "fleetcart/setting",
|
||||
"description": "The FleetCart Setting Module.",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Envay Soft",
|
||||
"email": "envaysoft@gmail.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^8.0.2"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Modules\\Setting\\": ""
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"sort-packages": true
|
||||
},
|
||||
"minimum-stability": "dev"
|
||||
}
|
||||
29
Modules/Setting/helpers.php
Normal file
29
Modules/Setting/helpers.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
if (! function_exists('setting')) {
|
||||
/**
|
||||
* Get / set the specified setting value.
|
||||
*
|
||||
* If an array is passed, we'll assume you want to set settings.
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param mixed $default
|
||||
* @return mixed|\Modules\Setting\Repository
|
||||
*/
|
||||
function setting($key = null, $default = null)
|
||||
{
|
||||
if (is_null($key)) {
|
||||
return app('setting');
|
||||
}
|
||||
|
||||
if (is_array($key)) {
|
||||
return app('setting')->set($key);
|
||||
}
|
||||
|
||||
try {
|
||||
return app('setting')->get($key, $default);
|
||||
} catch (PDOException $e) {
|
||||
return $default;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Modules/Setting/module.json
Normal file
13
Modules/Setting/module.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "Setting",
|
||||
"alias": "setting",
|
||||
"description": "Module for handling all site settings.",
|
||||
"priority": 10,
|
||||
"providers": [
|
||||
"Modules\\Setting\\Providers\\SettingServiceProvider",
|
||||
"Modules\\Setting\\Providers\\EventServiceProvider"
|
||||
],
|
||||
"files": [
|
||||
"helpers.php"
|
||||
]
|
||||
}
|
||||
3
Modules/Setting/webpack.mix.js
Normal file
3
Modules/Setting/webpack.mix.js
Normal file
@@ -0,0 +1,3 @@
|
||||
let mix = require('laravel-mix');
|
||||
|
||||
mix.js(`${__dirname}/Resources/assets/admin/js/main.js`, `${__dirname}/Assets/admin/js/setting.js`);
|
||||
Reference in New Issue
Block a user