$postTimestamp = '2023-01-01 00:00:01';
echo Carbon::parse($postTimestamp)->diffForHumans(Carbon::now());
// "5 days before"
//Локализация
Carbon::parse($postTimestamp)->locale('ru')->diffForHumans(Carbon::now());
useRoute
или $route
внутри vue компонента.// Получим объект текщего пути
const { currentRoute } = useRouter();
/*
Далее у него можно брать уже name, path и тп
*/
<template>
<header :class="{ 'is-absolute': isAbsolute }"></header>
</template>
<script setup lang="ts">
const { currentRoute } = useRouter();
/* Заменить на своё */
const isAbsolute = currentRoute.name === 'index' ;
</script>
const video = document.querySelector('video');
video.onseeked = (event) => {
console.log('Video found the playback position it was looking for.');
console.log(video.currentTime);
};
function timer(delay = 1000) {
//---
return setInterval(restOfTime, delay)
}
const questTimer = timer();
// ----
clearInterval(questTimer);
const params = new URLSearchParams({
FreightID: 1,
CabinCategoryID: 2,
Age16: parseInt(3),
Age12: parseInt(4),
Age5: parseInt(5),
Age1: parseInt(6),
Accommodation: 7,
});
const url = `${route( "TariffCalculationPassenger" )}${params}`
const xCSRFTOKEN = document.querySelector('meta[name="_token"]').getAttribute("content")
const options = {
method: 'GET',
headers: {
"X-CSRF-TOKEN": xCSRFTOKEN
}
};
const response = await fetch(url, options)