You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fetching the model trough the LogToDB class (like the examples above) might have some side-effects as tables and connections are
135
-
declared dynamically... aka made by Hackermann!
135
+
declared dynamically... aka made by Hackerman!
136
136
<br>
137
137

138
138
139
-
139
+
#### Adding tables/expanding collections
140
+
The Log handler for SQL expects the following schema:
141
+
```php
142
+
Schema::create('log', function (Blueprint $table) {
143
+
$table->increments('id');
144
+
$table->text('message')->nullable();
145
+
$table->string('channel')->nullable();
146
+
$table->integer('level')->default(0);
147
+
$table->string('level_name', 20);
148
+
$table->integer('unix_time');
149
+
$table->text('datetime')->nullable();
150
+
$table->longText('context')->nullable();
151
+
$table->text('extra')->nullable();
152
+
$table->timestamps();
153
+
});
154
+
```
155
+
This is the migration that ships with this plugin. You can add as many tables as you want, and reference them in the 'collection' config value.
156
+
Collection = table, I used the term collection as it works for both SQL/noSQL.
157
+
No migrations needed for MongoDB.
158
+
159
+
No indexes are added per default, so if you fetch a lot of log results based on specific time ranges or types: it might be a good idea to add some indexes.
160
+
140
161
#### Log Cleanup
141
162
There is a helper function to remove the oldest log events and keep a specified number
0 commit comments