meter icon indicating copy to clipboard operation
meter copied to clipboard

Entries not recording - MeterModel constructor doesn't take attributes

Open mk-1001 opened this issue 1 year ago • 0 comments

The addition of the __construct() method to MeterModel in the latest version prevents the type and content fields from recording, completely breaking the package /.

SQLSTATE[HY000]: General error: 1364 Field 'type' doesn't have a default value (SQL: insert into meter_entries (created_at) values (2023-03-21 01:50:02))

In the record() method of Monitor.php:

$result = $this->model->create([ 'type' => $type, 'is_slow' => $isSlow ? '1' : '0', 'content' => $content, 'created_at' => now(), ]);

Laravel Eloquent constructors should take $attributes = [] as a default argument, and call the parent constructor (parent__construct($attributes)).

Using Laravel 8.12, but the same issue will occur with many Laravel versions.

mk-1001 avatar Mar 21 '23 01:03 mk-1001