ConfigController.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace App\Http\Controllers\Api\V2;
  3. use App\Http\Controllers\Controller;
  4. use App\Models\Addon;
  5. use App\Models\BusinessSetting;
  6. use App\Models\Language;
  7. use Illuminate\Http\Request;
  8. use stdClass;
  9. class ConfigController extends Controller
  10. {
  11. public function addon_list()
  12. {
  13. $addons = Addon::all();
  14. return response()->json($addons);
  15. }
  16. public function activated_social_login()
  17. {
  18. $activated_social_login_list = BusinessSetting::whereIn('type', ['facebook_login', 'google_login', 'twitter_login'])->get();
  19. return response()->json($activated_social_login_list);
  20. }
  21. public function business_settings(Request $request)
  22. {
  23. $business_settings = BusinessSetting::whereIn('type', explode(',', $request->keys))->get()->toArray();
  24. // $language_object = new stdClass();
  25. // $language_object->id = -123123;
  26. // $language_object->type = 'default_lanuage';
  27. // $language_object->value = env('DEFAULT_LANGUAGE');
  28. // $language_object->lang = null;
  29. // $language_info = Language::where('code', env('DEFAULT_LANGUAGE'))->first();
  30. // $mobile_app = new stdClass();
  31. // $mobile_app->id = -12312;
  32. // $mobile_app->type = 'mobile_app_code';
  33. // $mobile_app->value = $language_info->app_lang_code;
  34. // $mobile_app->lang = null;
  35. // $rtl_object = new stdClass();
  36. // $rtl_object->id = -1231;
  37. // $rtl_object->type = 'rtl';
  38. // $rtl_object->value = $language_info->rtl;
  39. // $rtl_object->lang = null;
  40. // $new_array = [$language_object, $rtl_object, $mobile_app];
  41. // $settings = array_merge($business_settings, $new_array);
  42. return response()->json($business_settings);
  43. }
  44. }