hasMany(Order::class); } protected static function boot() { parent::boot(); static::creating(function ($model) { $model->hash = generateUniqueID((strlen(Invoice::count()) + 2)); }); } }