![]() |
Hi there!
How to start... ![]() PHP Code: public function crtSlug(string $name, $test = FALSE) My first Idea was to create a helper, but as you see, the method uses the model and the helper has no access to the "builder()". So my question is: how to create global method which are only works local, in the specific model? Thanks!
You can create a base model class that contains crtSlug() and make your three models extend this base class.
Oh, that was easy :-) I thought, it would be a problem to use the builder.
For all other noobs like me, here is what I did: First, I extend the Model: PHP Code: <?php PHP Code: <?php Thank you!
And I found more ;-)
My method to create a slug is always used on INSERT and UPDATE. In that case, you can make use of events: https://codeigniter.com/user_guide/model...del-events It's on my todo-list for my program... |
Welcome Guest, Not a member yet? Register Sign In |