Laravel检查用户是否有待处理的请求

时间:2019-05-04 08:07:37

标签: php laravel

https://imgur.com/a/HbQ5gEN

除非我从数据库中删除了以前的数据,否则新的预订将不起作用。

如何检查是否返回了先前数据的状态,然后该用户现在可以进行新的预订

$reservation = new PropertyReservation;
$reservation->reservation_name = $resident->resident_fname;
$reservation->reservation_type = $request->input('reservation_type');

检查用户是否有相同数据

 if(PropertyReservation::where('res_id', Auth::user()->res_id)->where('property_no',$reservation->property_no)->exists())
 {
    return redirect('/reservations')->with('success','You have an existing reservation for '. $request->input('reservation_type'));
 }

0 个答案:

没有答案