Welcome Guest, Not a member yet? Register   Sign In
Using something like a helper in model
#3

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

namespace App\Models;

class 
BaseModel extends Model
{

    /**
    * Creates a slug from a given name and increase sufix if slug is in use
    * @param $name STRING to make a slug from
    * @return string
    */
    public function crtSlug(string $name)
    {
        /* Stuff like above */
    }


And then extend this at the other three models:
PHP Code:
<?php

namespace App\Models;

class 
PageModel extends BaseModel
{
    /* use $this->crtSlug(); in every method here as you want */

Hmm... This is solved, but a further question on this... We well see us soon :-)

Thank you!
Reply


Messages In This Thread
RE: Using something like a helper in model - by sprhld - 10-26-2021, 10:40 AM



Theme © iAndrew 2016 - Forum software by © MyBB