Skip to content

Commit 4974e8c

Browse files
committed
Update code to support Laravel 6.
1 parent d3f57d3 commit 4974e8c

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
],
1313
"require": {
1414
"php": ">=7.1",
15-
"illuminate/support": "~5.6"
15+
"illuminate/support": ">=5.6"
1616
},
1717
"require-dev": {
1818
"orchestra/testbench": ">=3.7",

readme.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,24 @@
66
[![Travis (.org)](https://img.shields.io/travis/danielme85/laravel-log-to-db.svg?style=flat-square)](https://travis-ci.org/danielme85/laravel-log-to-db)
77
[![Codecov](https://img.shields.io/codecov/c/github/danielme85/laravel-log-to-db.svg?style=flat-square)](https://codecov.io/gh/danielme85/laravel-log-to-db)
88

9-
Custom Larvel 5.6+ Log channel handler that can store log events to SQL or MongoDB databases.
9+
Custom Laravel 6/5.6+ Log channel handler that can store log events to SQL or MongoDB databases.
1010
Uses Laravel native logging functionality.
1111

1212
## Installation
13+
For latest Laravel 6 Support
1314
```
1415
require danielme85/laravel-log-to-db
1516
```
1617

18+
For Laravel 5.6 -> 5.* Support you can either use the v1 branch or a v1 release, ex:
19+
```
20+
require danielme85/laravel-log-to-db:dev-v1
21+
```
22+
or
23+
```
24+
require danielme85/laravel-log-to-db "~1.1"
25+
```
26+
1727
If you are going to be using SQL database server to store log events you would need to run the migrations first. The MongoDB driver does not require the migration.
1828
```
1929
php artisan migrate

src/Models/LogToDbCreateObject.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace danielme85\LaravelLogToDB\Models;
44

5+
use Monolog\DateTimeImmutable;
6+
57
/**
68
* Trait LogToDbCreateObject
79
*
@@ -24,9 +26,9 @@ public function getContextAttribute($value)
2426
* DateTime Accessor
2527
*
2628
* @param $value
27-
* @return \DateTime
29+
* @return DateTimeImmutable
2830
*/
29-
public function getDatetimeAttribute($value) : \DateTime
31+
public function getDatetimeAttribute($value) : DateTimeImmutable
3032
{
3133
return unserialize($value);
3234
}
@@ -108,9 +110,9 @@ public function setContextAttribute(array $value)
108110
/**
109111
* DateTime Mutator
110112
*
111-
* @param \DateTime $value
113+
* @param DateTimeImmutable $value
112114
*/
113-
public function setDatetimeAttribute(\DateTime $value)
115+
public function setDatetimeAttribute(DateTimeImmutable $value)
114116
{
115117
$this->attributes['datetime'] = serialize($value);
116118
}

0 commit comments

Comments
 (0)