/**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $vehicle = Vehicle::findOrFail($id);
     $license_types = VehicleType::find($vehicle->vehicle_type_id)->license_types->toArray();
     $vehicle_types = VehicleType::all()->toArray();
     $vehicle_type_options = array();
     if (!empty($vehicle_types)) {
         foreach ($vehicle_types as $vehicle_type) {
             $vehicle_type_options[$vehicle_type['id']] = $vehicle_type['type'];
         }
     }
     $license_type_options = array();
     if (!empty($license_types)) {
         foreach ($license_types as $license_type) {
             $license_type_options[$license_type['id']] = $license_type['type'];
         }
     }
     $clients = User::select('id', 'first_name', 'last_name')->where('user_role', '=', '2')->get()->toArray();
     $client_options = array();
     if (!empty($clients)) {
         foreach ($clients as $client) {
             $client_options[$client['id']] = $client['first_name'] . " " . $client['last_name'];
         }
     }
     $license_type_arr = array();
     $license_types = Vehicle::find($id)->license_types->toArray();
     if (!empty($license_types)) {
         foreach ($license_types as $license_type) {
             $license_type_arr[] = $license_type['id'];
         }
     }
     return view('vehicle.update', compact('vehicle', 'vehicle_type_options', 'license_type_options', 'client_options', 'license_type_arr'));
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $model = VehicleType::findOrFail($id);
     $model->delete();
     Session::flash('flash_message', 'Vehicle type has been successfully deleted!');
     return redirect()->back();
 }