mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
MAke EventLog details jsonable
This commit is contained in:
parent
b10b41f3bf
commit
e62f72e235
@ -12,8 +12,8 @@ class DbSystemRequestLogs extends Migration
|
||||
{
|
||||
$table->engine = 'InnoDB';
|
||||
$table->increments('id');
|
||||
$table->string('url')->nullable();
|
||||
$table->integer('status_code')->nullable();
|
||||
$table->string('url')->nullable();
|
||||
$table->text('referer')->nullable();
|
||||
$table->integer('count')->default(0);
|
||||
$table->timestamps();
|
||||
|
@ -13,6 +13,11 @@ class EventLog extends Model
|
||||
*/
|
||||
protected $table = 'system_event_logs';
|
||||
|
||||
/**
|
||||
* @var array List of attribute names which are json encoded and decoded from the database.
|
||||
*/
|
||||
protected $jsonable = ['details'];
|
||||
|
||||
/**
|
||||
* Creates a log record
|
||||
* @param string $message Specifies the message text
|
||||
@ -25,10 +30,23 @@ class EventLog extends Model
|
||||
$record = new static;
|
||||
$record->message = $message;
|
||||
$record->level = $level;
|
||||
$record->details = $details;
|
||||
|
||||
if ($details !== null)
|
||||
$record->details = (array) $details;
|
||||
|
||||
$record->save();
|
||||
|
||||
return $record;
|
||||
}
|
||||
|
||||
/**
|
||||
* Beautify level value.
|
||||
* @param string $level
|
||||
* @return string
|
||||
*/
|
||||
public function getLevelAttribute($level)
|
||||
{
|
||||
return ucfirst($level);
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user