Edit File: IntroController.php
<?php namespace App\Http\Controllers\Site; use App\Models\{IntroHowWork, SiteSetting, IntroSocial, IntroSlider, IntroService, IntroMessages, IntroPartner, IntroFqsCategory}; use App\Http\Requests\Site\sendMessageRequest; use App\Http\Controllers\Controller; use App\Services\SettingService; use Illuminate\Support\Facades\DB; class IntroController extends Controller { public function index() { view()->share([ 'services' => IntroService::get(), 'sliders' => IntroSlider::get(), 'fqsCategories' => IntroFqsCategory::with('questions')->get(), 'partners' => IntroPartner::get(), 'howWorks' => IntroHowWork::get(), 'socials' => IntroSocial::get(), 'settings' => SettingService::appInformations(SiteSetting::pluck('value', 'key')), ]); return view('intro_site.index'); } public function privacyPolicy() { view()->share([ 'socials' => IntroSocial::get(), 'settings' => SettingService::appInformations(SiteSetting::pluck('value', 'key')), 'privacy' => json_decode(DB::table('pages')->whereSlug('privacy')->first()->content), ]); return view('intro_site.privacy'); } public function sendMessage(sendMessageRequest $request) { IntroMessages:: create($request->validated()); return response()->json(['status' => 'done', 'message' => __('intro_site.message_sent')]); } /***************** change lang *****************/ public function SetLanguage($lang) { if (in_array($lang, ['ar', 'en'])) { if (session()->has('lang')) session()->forget('lang'); session()->put('lang', $lang); } else { if (session()->has('lang')) session()->forget('lang'); session()->put('lang', 'ar'); } return back(); } public function deleteAccount() { view()->share([ 'socials' => IntroSocial::get(), 'settings' => SettingService::appInformations(SiteSetting::pluck('value', 'key')), ]); return view('intro_site.deleteAccount'); } }
Back to File Manager