<?php
$time_now = time(); // время сейчас в секундах
$date_start = date( '15.12.Y' ); // 15.01.2020
$date_end = date( '15.01.' ) . ( (int)date('Y') + 1 ); // 15.01.2021
$time_start = strtotime($date_start); // переводим в секунды
$time_end = strtotime($date_end ); // переводим в секунды
if( $time_now >= $time_start && $time_now <= $time_end ) { // сравниваем в секундах
echo 'something'; // выводим что-то
}
echo date( 'd.m.Y H:i:s', $time_now ); // дата сейчас
<?php
$currentDate = date('Y-m-d');
$currentDate = date('Y-m-d', strtotime($currentDate));
$startDate = date('Y-m-d', strtotime("01/09/2019"));
$endDate = date('Y-m-d', strtotime("01/10/2019"));
if (($currentDate >= $startDate) && ($currentDate <= $endDate)){
echo "Current date is between two dates";
}else{
echo "Current date is not between two dates";
}
$enity->active_at >= now()
public function handle(Request $request, Closure $next, string $subscription)
{
if (
$request->user()->subscription->name !== $subscription
|| $request->user()->subscription->valid_until < Carbon::now()
) {
abort(403);
}
return $next($request);
}
fetch(YOUR_URL, {
method: 'POST',
headers: {
'Client-Id': YOUR_CLIENT_ID,
'Api-Key': YOUR_API_KEY,
'Content-Type': 'application/json'
},
body: JSON.stringify({
offer_id: YOUR_OFFER_ID,
product_id: YOUR_PRODUCT_ID,
sku: YOUR_SKU
})
}).then(response => response.json()).then(data => {
console.log(data);
});