Welcome Guest, Not a member yet? Register   Sign In
Call multiple function in callback Models

hello admin @kenjis, hello everyone,
just wondering, is it possible to call multiple functions in a callback Models?

for example:
PHP Code:
protected $afterInsert = ['saveJob1','saveJob2']; 

What happens if you try it? Also, the type is specified as an array
Simple CI 4 project for beginners codeigniter-expenses

(This post was last modified: 05-14-2024, 11:35 PM by warcooft.)

when I tried it, it work properly.
the problem is I couldn't access the $data passed in the saveJob2 function, and then I dumped it the contents is null. but in saveJob1 $data param can be accessed and processed
see :

What did you do in the first event? If you have completed the request, most likely the data will be reset
Simple CI 4 project for beginners codeigniter-expenses

in the first event I only saved the data in tables that were related to the main table. See https://imgur.com/PUFlL52

Read https://codeigniter.com/user_guide/model...-callbacks

(05-15-2024, 12:46 AM)kenjis Wrote: Read https://codeigniter.com/user_guide/model...-callbacks

omg, i really never read this section before. Thanks @kenjis

Theme © iAndrew 2016 - Forum software by © MyBB