首页 > 解决方案 > laravel 稍后插入数据

问题描述

public function index()
{
    $value="";
    $now = time();
    if ($now == '1568739550'){
        $dummy = new Dummy();
        $dummy->name = "khan";
        $dummy->save();
    }else{
        $value = "not okay";
    }
    return view('home', compact('now', 'value'));
}

当我包含刷新浏览器时它正在工作。否则它不工作

标签: phplaravel

解决方案


用于此目的的碳如下..

// get the current time
$current = Carbon::now();
// add 30 days to the current time
$trialExpires = $current->addDay

然后简单地调用 if 函数

 if(your condition)
{
//Login goes here
} 

推荐阅读