step 1: This is my controller code. firebase file and firebase DB are connected properly. but when run in postman i got 500 error but I am new on firebase show I don't know how can I resolved this
public function ride_confirm(Request $request)
{
$input = $request->all();
$validator = Validator::make($input, [
'km' => 'required',
'vehicle_type' => 'required',
'customer_id' => 'required',
'promo' => 'required',
'country_id' => 'required',
'pickup_address' => 'required',
'pickup_date' => 'required',
'pickup_lat' => 'required',
'pickup_lng' => 'required',
'trip_type' => 'required'
]);
if ($validator->fails()) {
return $this->sendError($validator->errors());
}
$input['pickup_date'] = date("Y-m-d H:i:s", strtotime($input['pickup_date']));
$current_date = $this->get_date($input['country_id']);
$interval_time = $this->date_difference($input['pickup_date'],$current_date);
if($interval_time <= 30){
$input['booking_type'] = 1;
$input['status'] = 1;
}else{
$input['booking_type'] = 2;
$input['status'] = 2;
}
$factory = (new Factory)->withServiceAccount(config_path().'/'.env('FIREBASE_FILE'));
$factory = (new Factory())->withDatabaseUri(env('FIREBASE_DB'));
$database = $factory->createDatabase();
$drivers = $database->getReference('/vehicles/'.$input['vehicle_type'])
->getSnapshot()->getValue();
}
I faced this error when I run this code ...
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire