Reputation: 1187
I'm making a flight reservation in laravel and I published it on Heroku. I used MySQL for the database when I was on the development, but when I want to publish it on Heroku, they dont have MySQL so I used PostgreSQL. I watched some videos on how to host it using that database.
When I was done, I can do CRUD in the hosting site but when Im going to filter the flight schedules it gives me an error. But when I do a search in my localhost, It doesnt have any errors.
I think this error is in the I used which is PostgreSQL. How can I fix this?
The result when I search on localhost
The result when I search on Heroku
My filter method in the controller.
FlightsController.php
public function searchFlights(Request $request){
$flights = Flights::where('flight_country_from', 'like', '%' . $request->flightFrom . '%')
->where('flight_country_from', 'like', '%' . $request->flightFrom . '%')
->where('flight_country_to', 'like', '%' . $request->flightTo . '%')
->whereDate('flight_schedule', 'like', '%' . $request->flightDepart . '%')
->paginate(5);
return view('airways.flightresult', compact('flights'));
}
my search form
Search.blade.php
<div class="tab-pane fade" id="flights" role="tabpanel" aria-labelledby="flights-tab">
<h2 class="text-4 mb-3">Book Domestic and International Flights</h2>
<form method="GET" autocomplete="off" id="bookingFlight" action="{{url("/flightSearch")}}">
{{ csrf_field() }}
<div class="form-row">
<div class="col-md-8 col-lg-3 form-group">
<input class="form-control" type="text" name="flightFrom" id="flightFrom" placeholder="From">
<span class="icon-inside"><i class="fas fa-map-marker-alt"></i></span>
</div>
<div class="col-md-8 col-lg-3 form-group">
<input class="form-control" type="text" name="flightTo" id="flightTo" placeholder="To">
<span class="icon-inside"><i class="fas fa-map-marker-alt"></i></span>
</div>
<div class="col-md-8 col-lg-3 form-group">
<input class="form-control" name="flightDepart" id="flightDepart" required required placeholder="Departure Date">
<span class="icon-inside"><i class="far fa-calendar-alt"></i></span>
</div>
<div class="col-md-12 form-group">
<button class="btn btn-primary btn-block" type="submit">Search</button>
</div>
</div>
</form>
</div>
</div>
Upvotes: 0
Views: 101
Reputation: 136975
I strongly advise you to use the same database in development and production. MySQL and PostgreSQL aren't drop-in replacements for each other.
Either
Upvotes: 1