Browse Source

Move appSettings generation from blade template to controller

Bubka 5 years ago
parent
commit
6a694280cd

+ 3 - 1
app/Http/Controllers/SinglePageController.php

@@ -13,6 +13,8 @@ class SinglePageController extends Controller
      */
     public function index()
     {
-        return view("landing");
+        $appSettings = \Illuminate\Support\Facades\DB::table('options')->pluck('value', 'key')->toJson();
+
+        return view("landing")->with('appSettings', $appSettings);;
     }
 }

+ 1 - 1
resources/views/landing.blade.php

@@ -23,7 +23,7 @@
         <app></app>
     </div>
     <script type="text/javascript">
-        var appSettings = @json(\Illuminate\Support\Facades\DB::table('options')->pluck('value', 'key')->toArray(), JSON_PRETTY_PRINT)
+        var appSettings = {!! $appSettings !!}
     </script>
     <script src="{{ mix('js/app.js') }}"></script>
     <script src="{{ mix('js/locales.js') }}"></script>