Fixed Laravel 5.7 compatibility issue re: boot() method

This was causing the error: Undefined index: App\Models\CustomField (View: /Users/snipe/Sites/snipe-it/snipe-it/resources/views/hardware/index.blade.php)

and pointed to the Eloquent model library method:

```
protected function initializeTraits()
    {
        foreach (static::$traitInitializers[static::class] as $method) {
            $this->{$method}();
        }
    }
```

Thanks to https://github.com/laravel/framework/issues/25455 for the clue.
This commit is contained in:
snipe 2018-09-05 19:27:37 -07:00
parent 60459d07ce
commit b80b91514d

View file

@ -87,6 +87,7 @@ class CustomField extends Model
*/ */
public static function boot() public static function boot()
{ {
parent::boot();
self::created(function ($custom_field) { self::created(function ($custom_field) {
// Column already exists on the assets table - nothing to do here. // Column already exists on the assets table - nothing to do here.