ErrorException в 9fda7f278d3e747b3980918d324db22db9c3dd76. php строка 41: неопределенное свойство: stdClass :: $ distance
<dl class="dl-horizontal left-right">
<dt><?php echo app('translator')->get('user.type'); ?></dt>
<dd><?php echo e($service->name); ?></dd>
<dt><?php echo app('translator')->get('user.total_distance'); ?></dt>
<dd><?php echo e($fare->distance); ?> Kms</dd>
<dt><?php echo app('translator')->get('user.eta'); ?></dt>
<dd><?php echo e($fare->time); ?></dd>
<dt><?php echo app('translator')->get('user.estimated_fare'); ?></dt>
<dd><?php echo e(currency($fare->estimated_fare)); ?></dd>
<hr>
<?php if(Auth::user()->wallet_balance > 0): ?>
<input type="checkbox" name="use_wallet" value="1"><span style="padding-left: 15px;"><?php echo app('translator')->get('user.use_wallet_balance'); ?></span>
<br>
<br>
<dt><?php echo app('translator')->get('user.available_wallet_balance'); ?></dt>
<dd><?php echo e(currency(Auth::user()->wallet_balance)); ?></dd>
<?php endif; ?>
</dl>
Этот файл является кэшированной версией вашего одного из файлов просмотра Blade. Вам нужно либо найти исходный файл blade-сервера и отладить его, либо, если он уже исправлен, вам нужно запустить php artisan view: clear.
Но для отладки нам нужно больше данных о $ тарифе объект. мой клинок. php файл
<dl class="dl-horizontal left-right">
<dt>@lang('user.type')</dt>
<dd>{{$service->name}}</dd>
<dt>@lang('user.total_distance')</dt>
<dd>{{$fare->distance}} Kms</dd>
<dt>@lang('user.eta')</dt>
<dd>{{$fare->time}}</dd>
<dt>@lang('user.estimated_fare')</dt>
<dd>{{currency($fare->estimated_fare)}}</dd>
<hr>
@if(Auth::user()->wallet_balance > 0)
<input type="checkbox" name="use_wallet" value="1"><span style="padding-left: 15px;">@lang('user.use_wallet_balance')</span>
<br>
<br>
<dt>@lang('user.available_wallet_balance')</dt>
<dd>{{currency(Auth::user()->wallet_balance)}}</dd>
@endif
</dl>
public function confirm_ride(Request $request)
{
$fare = $this->UserAPI->estimated_fare($request)->getData();
$service = (new Resource\ServiceResource)->show($request->service_type);
$cards = (new Resource\CardResource)->index();
if($request->has('current_longitude') && $request->has('current_latitude'))
{
User::where('id',Auth::user()->id)->update([
'latitude' => $request->current_latitude,
'longitude' => $request->current_longitude
]);
}
return view('user.ride.confirm_ride',compact('request','fare','service','cards'));
}
public function estimated_fare(Request $request){
\Log::info('Estimate', $request->all());
$this->validate($request,[
's_latitude' => 'required|numeric',
's_longitude' => 'required|numeric',
'd_latitude' => 'required|numeric',
'd_longitude' => 'required|numeric',
'service_type' => 'required|numeric|exists:service_types,id',
]);
try{
$details = "https://maps.googleapis.com/maps/api/distancematrix/json?origins=".$request->s_latitude.",".$request->s_longitude."&destinations=".$request->d_latitude.",".$request->d_longitude."&mode=driving&sensor=false&key=".Setting::get('map_key');
$json = curl($details);
$details = json_decode($json, TRUE);
$meter = $details['rows'][0]['elements'][0]['distance']['value'];
$time = $details['rows'][0]['elements'][0]['duration']['text'];
$seconds = $details['rows'][0]['elements'][0]['duration']['value'];
$kilometer = round($meter/1000);
$minutes = round($seconds/60);
$rental = ceil($request->rental_hours);
$tax_percentage = Setting::get('tax_percentage');
$commission_percentage = Setting::get('commission_percentage');
$service_type = ServiceType::findOrFail($request->service_type);
$price = $service_type->fixed;
$hour = $service_type->hour;
if($service_type->calculator == 'MIN') {
$price += $service_type->minute * $minutes;
} else if($service_type->calculator == 'HOUR') {
$price += $service_type->minute * 60;
} else if($service_type->calculator == 'DISTANCE') {
$kilmin = $kilometer - $service_type->distance;
$price += ($kilmin * $service_type->price);
} else if($service_type->calculator == 'DISTANCEMIN') {
$kilmin = $kilometer - $service_type->distance;
$price += ($kilmin * $service_type->price) + ($service_type->minute * $minutes);
} else if($service_type->calculator == 'DISTANCEHOUR') {
$kilmin = $kilometer - $service_type->distance;
$price += ($kilmin * $service_type->price) + ($rental * $hour);
} else {
$kilmin = $kilometer - $service_type->distance;
$price += ($kilmin * $service_type->price);
}
$tax_price = ( $tax_percentage/100 ) * $price;
$total = $price + $tax_price;
$ActiveProviders = ProviderService::AvailableServiceProvider($request->service_type)->get()->pluck('provider_id');
$distance = Setting::get('provider_search_radius', '10');
$latitude = $request->s_latitude;
$longitude = $request->s_longitude;
$Providers = Provider::whereIn('id', $ActiveProviders)
->where('status', 'approved')
->whereRaw("(1.609344 * 3956 * acos( cos( radians('$latitude') ) * cos( radians(latitude) ) * cos( radians(longitude) - radians('$longitude') ) + sin( radians('$latitude') ) * sin( radians(latitude) ) ) ) <= $distance")
->get();
$surge = 0;
if($Providers->count() <= Setting::get('surge_trigger') && $Providers->count() > 0){
$surge_price = (Setting::get('surge_percentage')/100) * $total;
$total += $surge_price;
$surge = 1;
}
/*
* Reported by Jeya, previously it was hardcoded. we have changed as based on surge percentage.
*/
$surge_percentage = 1+(Setting::get('surge_percentage')/100)."X";
return response()->json([
'estimated_fare' => round($total,2),
'distance' => $kilometer,
'time' => $time,
'surge' => $surge,
'surge_value' => $surge_percentage,
'tax_price' => $tax_price,
'base_price' => $service_type->fixed,
'wallet_balance' => Auth::user()->wallet_balance
]);
} catch(Exception $e) {
return response()->json(['error' => trans('api.something_went_wrong')], 500);
}
}