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?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire