Skip to content

Commit 8a9964a

Browse files
committed
Various changes (progress)
1 parent 362f048 commit 8a9964a

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace Academe\Laravel\ContextualNotes\Logging;
4+
5+
use Monolog\Logger;
6+
7+
class CreateContextualLogger
8+
{
9+
public function __invoke(array $config)
10+
{
11+
return new Logger(...);
12+
}
13+
}

src/Models/Note.php

+5-6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*/
99

1010
use Illuminate\Database\Eloquent\Model;
11+
use Traversable;
1112
use Log;
1213

1314
class Note extends Model
@@ -42,7 +43,7 @@ public function models($model)
4243
* Add this note to a single model.
4344
*
4445
* @param Model $model any eloquent mndel
45-
* @return TBC
46+
* @return bool
4647
*/
4748
public function attachModel(Model $model)
4849
{
@@ -51,15 +52,13 @@ public function attachModel(Model $model)
5152

5253
/**
5354
* Add this note to a list of models.
54-
* TODO: more flexibility of the types of lists that can be provided, or
55-
* even support varidiac (?) parameters.
5655
*
57-
* @param array $models eloquent mndels, of the same or different types
56+
* @param array|Traversable $models eloquent mndels, of the same or different types
5857
* @return self
5958
*/
6059
public function attach($models)
6160
{
62-
if (! is_array($models) && ! $models instanceof \Traversable) {
61+
if (! is_array($models) && ! $models instanceof Traversable) {
6362
$models = [$models];
6463
}
6564

@@ -91,7 +90,7 @@ public function __call($method, $arguments)
9190
}
9291

9392
/**
94-
* Write a log entry for this note, to the default log.
93+
* TODO: Write a log entry for this note, to the default log.
9594
*/
9695
public function withLog()
9796
{

0 commit comments

Comments
 (0)