Reputation: 79
Hi i try this in my model
public static function truncate(){
/*my some code*/
static::truncate();
}
MyModel::truncate();
but i get recursive call. How to organize it correctly?
Upvotes: 0
Views: 52
Reputation: 25906
Use this:
public static function truncate() {
/*my some code*/
(new static)->newQuery()->truncate();
}
Upvotes: 2