Welcome Guest, Not a member yet? Register   Sign In
restrict query in callback
#1

(This post was last modified: 09-12-2023, 06:40 AM by sjender.)

Hi,

I want to do some checks prior to some queries in the model.
In the $beforeUpdate and $beforeDelete callback I append the query by 
PHP Code:
$this->builder()->where('id'null); 
when the conditions are not met. (my ID's won't ever be NULL, resulting in an UPDATE or DELETE which won't work)

But this won't work on an insert.

I have a callback which determines whether the insert is valid, but I can't find a way to prevent the insert from happening when the right conditions are not met.
I have tried $this->builder()->resetQuery, but that still doesn't prevent the query from running...
Reply


Messages In This Thread
restrict query in callback - by sjender - 09-12-2023, 06:39 AM
RE: restrict query in callback - by sammyskills - 09-12-2023, 06:53 AM
RE: restrict query in callback - by sjender - 09-12-2023, 06:57 AM
RE: restrict query in callback - by kenjis - 09-12-2023, 09:30 PM



Theme © iAndrew 2016 - Forum software by © MyBB