This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

brady7512
brady7512

Hi, Is there an example on how to use the beforeFetch event in the model? What I have tried is not working:

function beforeFetch(){
  $this->admin_id = 55;
}

I also tried

function beforeFetch(){
        $this->where('admin_id', '=', 55);
}

I know I caught the hook correctly because I am able to kill the application. But I can't see how to transfer search parameters back to the model. Any help would be appreciated, thanks!

Last updated

brady7512
brady7512

For anybody else that runs into this, I found a different way of solving this through the controller and not the model.

public function listExtendQuery($query){
  $query->where('admin_id', 55);
}

Last updated

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.