-2
How do I compare the date created_at
with the current date and show the notes with that date
index php.
@if(\Carbon\Carbon::create($data)->format('d-m-Y') === \Carbon\Carbon::create($creat)->format('d-m-Y'))
@foreach ($hoje as $hj)
{{$hj>created_at}} //mostre os apontamentos de hoje
@endforeach
@else
teste
@endif
Controller
$data = Carbon::today();
$creat = Apontamento::get('created_at');
$hoje = Apontamento::all();
So it’s very little information, there’s no way to answer!
– novic
@Virgilionovic but I didn’t understand ? i wanted to know how I compare two date, one of the bank and current date, I’m using the Carbon, but I’m not getting
– Bruno
Compare dates in PHP has several examples on the site, already searched ???
– novic
https://answall.com/questions/33469/como-comparar-datas-em-php an example!
– novic
yes.. I saw ai in index qe posted until in Function I used new data(), Datatime('NOW') and I could not...
– Bruno
'Cause there’s no rule there
View
... you can send a status to yourview
if the date is met. As we do not know what to do gets complicated.– novic
I saw that one, I tried to do it, but for Laravel.. I couldn’t... @Virgilionovic
– Bruno
Return view('home', Compact('client', 'pointing', 'aptFinalized', 'aptPendente', 'data', 'creat', 'today')); @Virgilionovic
– Bruno
First you have to learn PHP and then use Laravel. Because the Framework is done in PHP and with the database information you already have a comparison.
– novic
And what’s in your
View
cannot be compared like this, it needs to be the same as in this link: https://answall.com/questions/33469/howto comparedatas-em-php or even more here– novic
@Virgilionovic I’ll take a look, but thank you
– Bruno