So I've succeeded to make a calendar display for the current month. This time, I want to show event details for a specific date. I'm not sure how to get the $event
data where $event == $date
.
This is the controller. I have event and dates to be used in the view:
$event = Event::where("started_at", '>=', Carbon::now()->subDays(30)->toDateTimeString())
->orderBy("started_at", "asc")
->first();
$data["event"] = $event;
$data["month"] = Carbon::now()->month;
$data["dates"] = range('1', date('t'));
return view('event.all', $data);
This is the event.all
view:
@foreach($dates as $date)
<div class="seven-cols">
<div class="titlehead">
<h6>{{$date}}</h6>
<h6 style="color: lightgrey;">{{date("D", mktime(0, 0, 0, $month, $date))}}</h6>
<div style=" ">{{$eventdate = date('d',strtotime(@$event->started_at))}}</div>
@if($event->started_at == $date)
<div>Test</div>
@endif
</div>
</div>
@endforeach
What I got for this code: