encode($mt); } /** * Register callbacks */ protected static function boot() { parent::boot(); static::creating(function ($model) { $key = $model->getKeyName(); if (empty($model->{$key})) { $id = static::createNewHashId(); $model->{$key} = $id; } }); } }