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

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']; 
Reply
#2

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

(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 :
https://imgur.com/a/fi7GwKX
Reply
#4

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
Reply
#5

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

Read https://codeigniter.com/user_guide/model...-callbacks
Reply
#7

(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
Reply




Theme © iAndrew 2016 - Forum software by © MyBB