update marketing
All checks were successful
All checks were successful
This commit is contained in:
@@ -2,14 +2,16 @@
|
||||
|
||||
namespace Modules\Business\App\Http\Controllers;
|
||||
|
||||
use App\Models\Option;
|
||||
use App\Models\Business;
|
||||
use App\Helpers\HasUploader;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\BusinessCategory;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Business;
|
||||
use App\Models\BusinessCategory;
|
||||
// use App\Models\Country;
|
||||
use App\Models\Option;
|
||||
// use App\Models\State;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class SettingController extends Controller
|
||||
{
|
||||
@@ -18,14 +20,16 @@ class SettingController extends Controller
|
||||
public function index()
|
||||
{
|
||||
$setting = Option::where('key', 'business-settings')
|
||||
->where('value', 'LIKE', '%"business_id":%' . auth()->user()->business_id . '%')
|
||||
->where('value', 'LIKE', '%"business_id":' . auth()->user()->business_id . '%')
|
||||
->get()
|
||||
->firstWhere('value.business_id', auth()->user()->business_id);
|
||||
|
||||
$business_categories = BusinessCategory::whereStatus(1)->latest()->get();
|
||||
$business = Business::findOrFail(auth()->user()->business_id);
|
||||
$countries = [];
|
||||
$states = [];
|
||||
|
||||
return view('business::settings.general', compact('setting', 'business_categories', 'business'));
|
||||
return view('business::settings.general', compact('setting', 'business_categories', 'business', 'countries', 'states'));
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
@@ -56,6 +60,8 @@ public function update(Request $request, $id)
|
||||
'show_invoice_scanner_logo' => 'nullable|boolean',
|
||||
'show_a4_invoice_logo' => 'nullable|boolean',
|
||||
'show_thermal_invoice_logo' => 'nullable|boolean',
|
||||
// 'country_id' => 'nullable|exists:countries,id',
|
||||
// 'state_id' => 'nullable|exists:states,id',
|
||||
]);
|
||||
|
||||
DB::beginTransaction();
|
||||
@@ -71,14 +77,12 @@ public function update(Request $request, $id)
|
||||
'email' => $request->email,
|
||||
'vat_name' => $request->vat_name,
|
||||
'vat_no' => $request->vat_no,
|
||||
// 'country_id' => $request->country_id,
|
||||
// 'state_id' => $request->state_id,
|
||||
]);
|
||||
|
||||
$moduleKeys = [
|
||||
'show_company_name',
|
||||
'show_phone_number',
|
||||
'show_address',
|
||||
'show_email',
|
||||
'show_vat',
|
||||
'show_company_name', 'show_phone_number', 'show_address', 'show_email', 'show_vat',
|
||||
];
|
||||
|
||||
$modules = [];
|
||||
@@ -96,7 +100,7 @@ public function update(Request $request, $id)
|
||||
|
||||
if ($setting) {
|
||||
$setting->update($request->except($data) + [
|
||||
'value' => $request->except('_token', '_method', 'a4_invoice_logo', 'thermal_invoice_logo', 'invoice_scanner_logo', 'address', 'companyName', 'business_category_id', 'phoneNumber', 'email', 'show_company_name', 'show_phone_number', 'show_address', 'show_email', 'show_vat') + [
|
||||
'value' => $request->except('_token', '_method', 'a4_invoice_logo', 'thermal_invoice_logo', 'invoice_scanner_logo', 'address', 'companyName', 'business_category_id', 'phoneNumber', 'email', 'show_company_name', 'show_phone_number', 'show_address', 'show_email', 'show_vat' ) + [
|
||||
'business_id' => $business->id,
|
||||
'a4_invoice_logo' => $request->a4_invoice_logo ? $this->upload($request, 'a4_invoice_logo', $setting->value['a4_invoice_logo'] ?? null) : ($setting->value['a4_invoice_logo'] ?? null),
|
||||
'thermal_invoice_logo' => $request->thermal_invoice_logo ? $this->upload($request, 'thermal_invoice_logo', $setting->value['thermal_invoice_logo'] ?? null) : ($setting->value['thermal_invoice_logo'] ?? null),
|
||||
@@ -140,7 +144,7 @@ public function update(Request $request, $id)
|
||||
'show_invoice_scanner_logo' => 1,
|
||||
'show_a4_invoice_logo' => 1,
|
||||
'show_thermal_invoice_logo' => 1,
|
||||
'show_warranty' => 1,
|
||||
'show_warranty' => 1 ,
|
||||
]),
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
|
||||
Reference in New Issue
Block a user