Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/249.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何将今天的日期与使用Laravel 5.4创建的日期时间戳进行比较_Php_Laravel_Laravel 5_Laravel 5.4 - Fatal编程技术网

Php 如何将今天的日期与使用Laravel 5.4创建的日期时间戳进行比较

Php 如何将今天的日期与使用Laravel 5.4创建的日期时间戳进行比较,php,laravel,laravel-5,laravel-5.4,Php,Laravel,Laravel 5,Laravel 5.4,我想让用户每1年更新一次应用程序。例如,今天是2017年8月14日,如果日期是2018年8月14日,应用程序将告诉用户他需要续订应用程序 @if ($application->created_at->todatestring() != 2018-08-14) <h1>You need to renew your application!</h1> @endif @if($application->created_at->todatestring()!=

我想让用户每1年更新一次应用程序。例如,今天是2017年8月14日,如果日期是2018年8月14日,应用程序将告诉用户他需要续订应用程序

@if ($application->created_at->todatestring() != 2018-08-14)
   <h1>You need to renew your application!</h1>
@endif
@if($application->created_at->todatestring()!=2018-08-14)
你需要更新你的申请!
@恩迪夫
因此,默认情况下,并不总是需要更新应用程序。那么,明年我将如何获得来年的价值呢?如何增加年数或将年数加1

正在寻求帮助。
提前感谢。

预计在创建的
是一个对象:

@if($application->created_at->addYear()->gt(\Carbon\Carbon::now()))
你需要更新你的申请!
@恩迪夫

请参阅详细信息。

处创建的预期
是一个对象:

@if($application->created_at->addYear()->gt(\Carbon\Carbon::now()))
你需要更新你的申请!
@恩迪夫

查看更多信息。

谢谢!顺便问一下,如果我更改了机器中的时间设置,我的应用程序总是会崩溃,那么我该如何测试它是否工作呢!顺便问一下,如果我更改了机器中的时间设置,我的应用程序总是会崩溃,那么我该如何测试它是否工作呢?
@if ($application->created_at->addYear()->gt(\Carbon\Carbon::now()))
    <h1>You need to renew your application!</h1>
@endif