samedi 29 février 2020

laravel public variable for different controllers

I want to set a public variable so I can use it in different controllers. I tried this but it is not successful.

class HomeController extends Controller
{
 public $TravelId;
public function __construct()
{
 $this->TravelId=0;
}
}

then I used the same variable in another contorller

class HomeController extends Controller
{
public function index($cus_id)
{
    //unique key for each user
    $this->TravelId = $cus_id;
}
}


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2uG8vJX
via IFTTT

Aucun commentaire:

Enregistrer un commentaire