owen-it / laravel-auditing

Record the change log from models in Laravel
https://laravel-auditing.com
MIT License
3.01k stars 387 forks source link

Error when implementing transformAudit #914

Closed brunobacha closed 4 months ago

brunobacha commented 6 months ago
Q A
Bug? yes
New Feature? no
Framework Laravel
Framework version 11.0.3
Package version 13.6"
PHP version 8.3.3

Steps to Reproduce

  1. Implement transformAudit()
    
    <?php

namespace App\Models;

use App\Models\BaseModel; use Illuminate\Support\Facades\Config; use OwenIt\Auditing\Contracts\Auditable;

class AuditableModel extends BaseModel implements Auditable { use \OwenIt\Auditing\Auditable;

/**
 * {@inheritdoc}
 */
public function transformAudit(array $data): array
{
    $data['system_id'] = optional(Config::get('system'))->id;
    return $data;
}

}

2. composer update or php artisan package:discover --ansi

In Facade.php line 354:

A facade root has not been set.

parallels999 commented 6 months ago

I couldn't reproduce the problem, maybe it is related to your environment or your implementation

parallels999 commented 4 months ago

Closed due inactivity