Delete functionality also the restore functionality same table

I want functionality where delete function call then the database record delete, also that record will restore when i call the restore function same database.
How can do this logic. in cakephp. when i restore the deleted record that we wan’t the it’s previous ID.
If any idea to build this logic Please suggest.

Trash Behavior :

Thanks, How can i implement this on my project,i tried the setup as per documentation, Well
I have table structure like as follows: Please what i can do ?

CREATE TABLE public.batches
    id integer NOT NULL DEFAULT nextval('batches_id_seq'::regclass),
    title character varying(155) COLLATE pg_catalog."default" NOT NULL,
    subject_id integer NOT NULL,
    standard_id integer NOT NULL,
    teacher_id integer NOT NULL,
    created timestamp with time zone NOT NULL,
    modified timestamp without time zone,
    is_deleted boolean DEFAULT false,
    CONSTRAINT batches_pkey PRIMARY KEY (id)

what should i do next ?

RTFM :slight_smile:

It’s all described there.