delete update fuel types

parent ee84446c
......@@ -40,4 +40,25 @@ class FuelController extends Controller
$message = 'Type or Price cannot be empty';
}
return response()->json(['message'=>$message]);
}
// This function for delete a Fuel type
public function delete_fuel_type(Request $req){
$fueltype = Fueltype::find($req->id);
$fueltype->delete();
return response()->json(['message'=>'success']);
}
// This function for update a Fuel type
public function update_fuel_type(Request $req){
$fueltype = Fueltype::find($req->id);
$fueltype->update([
'name' => $req->name,
'price' => $req->price,
]);
return response()->json(['message'=>'success']);
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment