diff --git a/modules/system/database/migrations/2014_10_01_000012_Db_System_Request_Logs.php b/modules/system/database/migrations/2014_10_01_000012_Db_System_Request_Logs.php index e47a79543..7d31258c3 100644 --- a/modules/system/database/migrations/2014_10_01_000012_Db_System_Request_Logs.php +++ b/modules/system/database/migrations/2014_10_01_000012_Db_System_Request_Logs.php @@ -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(); diff --git a/modules/system/models/EventLog.php b/modules/system/models/EventLog.php index 0b91c3714..d9eed6fb7 100644 --- a/modules/system/models/EventLog.php +++ b/modules/system/models/EventLog.php @@ -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); + } + } \ No newline at end of file