<?php

namespace App\Http\Controllers;

use App\Http\Requests\SalesForceVehicleNotificationRequest;

class SalesForceNotificationController extends Controller
{
    public function notifyVehicle(SalesForceVehicleNotificationRequest $request)
    {
        if ($request->vehicle()) {
            $request->vehicle()->price = $request->input('price');
            $request->vehicle()->is_published = (bool)$request->input('is_published');
            $request->vehicle()->is_reserved = (bool)$request->input('is_reserved');
            $request->vehicle()->is_sold = (bool)$request->input('is_sold');
            $request->vehicle()->save();
        }

        return response('ok');
    }
}
