[英]Laravel project hosting error in heroku using postgreSQL
我正在laravel進行航班預訂,並將其發布在Heroku上。 在開發過程中,我將MySQL用於數據庫,但是當我想在Heroku上發布數據庫時,他們沒有MySQL,因此我使用了PostgreSQL。 我觀看了有關如何使用該數據庫托管它的一些視頻。
完成后,我可以在托管站點中執行CRUD,但是當我要過濾航班時刻表時,這會給我一個錯誤。 但是,當我在本地主機中進行搜索時,它沒有任何錯誤。
我認為這個錯誤是在我使用的是PostgreSQL中。 我怎樣才能解決這個問題?
我在控制器中的過濾方法。
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'));
}
我的搜尋表格
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>
我強烈建議您在開發和生產中使用相同的數據庫。 MySQL和PostgreSQL並不是彼此的直接替代品。
或
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.