your code has infinite recursion
public function update(){ // <--
$query = "UPDATE `stock` SET `status`= 'expired'"; // |
$data =[$this->status]; // |
return $this->update($query, $data); // --
}
the only solution is to change the code and remove the infinite recursion.
eg. rename public function update() into public function updateDb():
public function updateDb(){
$query = "UPDATE `stock` SET `status`= 'expired'";
$data =[$this->status];
return $this->update($query, $data);
}
after, refractoring your code and call updateDb() instead of update()