Level 102
@if(!now()->lt($row->expiredDate)
Hello World(test)
@else
Test
@endif
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I want to hide a text if value of date in table is today's and after todays date's, for now I can get todays date using carbon method, so I can hide the text if the date value is todays date. I want to hide after today's date also
my controller
function test_query(Request $request){
$data = DB::table('companyregisters')
->join('voucherdetails','companyregisters.id','=','voucherdetails.company_id')
->join('addvouchers','voucherdetails.id','=','addvouchers.voucher_id')
->select('voucherdetails.description','companyregisters.companyName','addvouchers.voucherCode', 'addvouchers.voucherTitle' , 'companyregisters.file', 'addvouchers.quantity','addvouchers.id','addvouchers.expired','addvouchers.expiredDate')
->where(['companyregisters.category' => 'Fashion'])
->get();
$date = Carbon::now();
$todaysDate = $date->toDateString();
return view('voucherCategory/fashion',['data' => $data],['todaysDate ' => $todaysDate ]); }
my blade.php
@if($row->expiredDate == $todaysDate )
Hello World(test)
@else
Test
@endif
my table
$addvoucher->voucherTitle = $request->input('voucherTitle');
$addvoucher->voucherCode = $request->input('voucherCode');
$addvoucher->user_id = Auth::user()->id;
$addvoucher->quantity = $request->input('quantity');
$addvoucher->expiredDate = $request->input('datepicker');
@if(!now()->lt($row->expiredDate)
Hello World(test)
@else
Test
@endif
Please or to participate in this conversation.