Skip to main content
Version: 0.1.0

The ExceptionLog and ExceptionLogGroup model

Here are some features of the ExceptionLog Model and ExceptionLogGroup that can be useful for your project:

ExceptionLog

Fillable Fields

Field NameDescription
messageThe error message associated with the exception
typeThe type of the exception
fileThe file where the exception occurred
statusThe status of the exception log
traceThe stack trace of the exception
requestThe HTTP request associated with the exception
lineThe line number where the exception occurred
thrown_atThe date and time when the exception was thrown
exception_log_group_idThe ID of the exception log group that this exception log belongs to

Casts

NameDescription
statusThe status of the exception log, casted to the ExceptionLogStatus enum
traceThe stack trace of the exception, casted to an array
requestThe HTTP request associated with the exception, casted to an array
thrown_atThe date and time when the exception was thrown, casted to an immutable datetime object

Methods

Method NameReturn TypeDescription
site()HasOneThroughReturns a HasOneThrough relationship between the ExceptionLog model and the Site model through the ExceptionLogGroup model. This method allows you to retrieve the site associated with the exception log.
exceptionLogGroup()BelongsToReturns a BelongsTo relationship between the ExceptionLog model and the ExceptionLogGroup model. This method allows you to retrieve the exception log group that this exception log belongs to.

ExceptionLogGroup

Fillable Fields

Field NameDescription
site_idThe ID of the site associated with the exception log group
messageThe error message associated with the exception
typeThe type of the exception
fileThe file where the exception occurred
lineThe line number where the exception occurred
first_seenThe date and time when the exception was first seen
last_seenThe date and time when the exception was last seen

Casts

NameDescription
first_seenThe date and time when the exception was first seen, casted to an immutable datetime object
last_seenThe date and time when the exception was last seen, casted to an immutable datetime object

Methods

Method NameReturn TypeDescription
exceptionLogs()HasManyReturns a HasMany relationship between the ExceptionLogGroup model and the ExceptionLog model. This method allows you to retrieve the exception logs associated with this exception log group.
site()BelongsToReturns a BelongsTo relationship between the ExceptionLogGroup model and the Site model. This method allows you to retrieve the site associated with this exception log group.

Using a custom Exception Log Model

In case you want to create a custom ExceptionLog model or extends it capabilities we recommend you the following steps:

  1. Create a new ExceptionLog class that extends from Illuminate\Database\Eloquent\Model and implements the Taecontrol\MoonGuard\Contracts\MoonGuardExceptionLog interface.
<?php

use Illuminate\Database\Eloquent\Model;
use Taecontrol\MoonGuard\Contracts\MoonGuardExceptionLog;

class ExceptionLog extends Model implements MoonGuardExceptionLog
{
// Contract implementation
}
  1. Implement all the properties and methods required, you can guide yourself with the original ExceptionLog.php model from Moonguard.

  2. Replace the new ExceptionLog model class in the configuration file.

[
'exceptions' => [
'enabled' => true,
'notify_time_between_group_updates_in_minutes' => 15,
'exception_log' => [
'model' => \Taecontrol\MoonGuard\Models\ExceptionLog::class,
],
'exception_log_group' => [
'model' => \Taecontrol\MoonGuard\Models\ExceptionLogGroup::class,
],
],
]

In case you want to re implement the ExceptionLogGroup model you can use the guide of ExceptionLog model and implement Taecontrol\MoonGuard\Contracts\MoonGuardExceptionLogGroup and ExceptionLogGroup.php