I want use parent construct for calling once variable
class Home extends Controller {
public function __construct(){
$expiresAt = 10;
}
public function index() {
$data = Cache::remember('table', $expiresAt, function() {
return DB::table('table')
->ORDERBY('date', 'DESC')
->WHERE('status', 1)
->paginate(8);
});
return view('frontend.pages.home', compact('title', 'meta', 'description', 'all_resto'));
}
}
I have this response "Undefined variable: expiresAt" Where is the problem