codeigniter email validate and dublicate from database in php

Create a custom callback function for email validation in CodeIgniter. Inside the function, check if the email already exists in the database using the model. If it exists, return false to indicate validation failure. If it doesn't exist, return true to indicate validation success. Set the custom callback function as a rule for the email field in the form validation rules.