Laravel version: 7.6.
I tried to set config dynamically.
In AppServiceProvider.php, I put like this.
public function boot()
{
\Config::set("variable.custom", "test"); // this worked well.
}
But I needed to get value from Session var.
public function boot()
{
\Session::get("test"); // returned null even used Illuminate\Support\Facades\Session.
}
So I searched about it and found one answer.
public function boot()
{
view()->composer('*', function () {
$test= \Session::get("test"); // this worked well.
\Config::set("variable.custom", $test); // but this didn't work.
}
}
Is there any solution? Can anyone help me?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2TYhCiH
via IFTTT
Aucun commentaire:
Enregistrer un commentaire