jeudi 27 septembre 2018

Laravel changing config value of view_id in Analytics.php

My config/analytics.php

<?php 

return [

'view_id' => 1111111,


'cache_lifetime_in_minutes' => 60 * 24,


'cache' => [
    'store' => 'file',
  ],
];

What I want to happen is set the view_id => googleApi at my Controller.

public function showSpecificSite($site_id){

$reports = Report::whereHas('site', function($query) use($site_id) {
         $query->where('site_id', $site_id);
})->get(['email_date', 'url', 'recipient', 'report_id', 'site_id']);

$googleApi = DB::table('sites')->where('site_id', $site_id)->value('ga_id');
Config::set('view_id', $googleApi);

$siteName = Site::find($site_id)->site_name;

return view('newsite', compact('site_id', 'siteName', 'reports'));
}

I tried config:set but it didn't help me at all.

Do you have any idea or thoughts how to fix this?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire