如何从 6 个月增加飞蛾?



我正在制作维护系统。 用户可以支付 6 个月的维护费用,前 6 个月和最后 6 个月分为两部分,如果用户可以支付前 6 个月的费用,那么它可以增加 6 个月,依此类推

if($request->session()->has('email')){
$abc=(Session::get('email'));
$users=Carbon::create(2019,0,30)->addMonths(6); 
$check=$users->toDatestring();
}
if(Maintenance::where(['email', '=', $abc,'maintenance_status', '=', 'PAID'])){
$check= $users->addMonths(6);
$check=$users->toDatestring();
}           
return view('maintenance',['check'=>$check],['abc'=>$abc]);
i expect to increment from 6 6 months but it can gives second increment not step by step like 2019-1-1 add 6 moths 2019-6-30 and if user can pay first part of maintenance then only increment by 6 months and so..

使用碳:

您需要导入 Carbon 的命名空间

use CarbonCarbon;
$articles=Article::where("created_at",">", Carbon::now()->subMonths(6))->get();

将此逻辑应用于你的方案。

最新更新