consider that i have 2 dates like below in my view :
{{$property->start_date }} //which is for example 3/20/219
and another date
{{$property->end_date }} //which is for example 3/28/219
now i want to some how print these 8 days of difference as 8 col-lg-1 some how like below code
@while($property->start_date <= $property->end_date)
//here i want to print dates in col-lg-1 i dont know how to access the day and if the while loop is working right or no
how can i achieve that in blade considering this that i am doing this in my view and is it reasonable at all to do it in view or not .
You can use the CarbonPeriod
from Carbon
something likes this
$ranges = CarbonPeriod::create('2019-03-01', '2019-03-31');
To print each date you can use the loop
foreach ($ranges as $date) {
echo $date->format('Y-m-d');
}
Or you can convert it to array as well
$dates = $ranges->toArray();
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다