Hello guys,
Sorry to bother you, I have this situation:
I have a table named: create_vouchers, inside of it there is a column named: arrivaldate
I'm trying to fetch all these arrival dates if the current date matches the arrival dates from the database.
Example: if there is a record with arrival date 19-08-2022 and today is 19-08-2022 then it should be listed. here is my code:
class ArrivalsDeparturesController extends Controller
{
public function index()
{
abort_if(Gate::denies('arrivals_departure_access'), Response::HTTP_FORBIDDEN, '403 Forbidden');
$CurrentDate = date('m-d-Y');
$Arrivals = DB::table('create_vouchers')
->select('id', 'client_name', 'night', 'hotel_name_id')
->where('arrivaldate', '=', $CurrentDate)
->first();
//$Arrivals = AppCreateVoucher::All();
return view('admin.arrivalsDepartures.index', compact('Arrivals'));
}
}
My index.blade.php View
@extends('layouts.admin')
@section('content')
<div class="content">
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading">
{{ trans('cruds.arrivalsDeparture.title') }}
</div>
<div class="panel-body">
<p>
@php
echo $Arrivals;
@endphp
</p>
</div>
</div>
</div>
</div>
</div>
@endsection
Nothing is see from the view.