Skip to content

Commit

Permalink
Various changes (progress)
Browse files Browse the repository at this point in the history
  • Loading branch information
judgej committed Apr 4, 2018
1 parent 362f048 commit 8a9964a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
13 changes: 13 additions & 0 deletions src/Logging/CreateContextualLogger.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace Academe\Laravel\ContextualNotes\Logging;

use Monolog\Logger;

class CreateContextualLogger
{
public function __invoke(array $config)
{
return new Logger(...);
}
}
11 changes: 5 additions & 6 deletions src/Models/Note.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

use Illuminate\Database\Eloquent\Model;
use Traversable;
use Log;

class Note extends Model
Expand Down Expand Up @@ -42,7 +43,7 @@ public function models($model)
* Add this note to a single model.
*
* @param Model $model any eloquent mndel
* @return TBC
* @return bool
*/
public function attachModel(Model $model)
{
Expand All @@ -51,15 +52,13 @@ public function attachModel(Model $model)

/**
* Add this note to a list of models.
* TODO: more flexibility of the types of lists that can be provided, or
* even support varidiac (?) parameters.
*
* @param array $models eloquent mndels, of the same or different types
* @param array|Traversable $models eloquent mndels, of the same or different types
* @return self
*/
public function attach($models)
{
if (! is_array($models) && ! $models instanceof \Traversable) {
if (! is_array($models) && ! $models instanceof Traversable) {
$models = [$models];
}

Expand Down Expand Up @@ -91,7 +90,7 @@ public function __call($method, $arguments)
}

/**
* Write a log entry for this note, to the default log.
* TODO: Write a log entry for this note, to the default log.
*/
public function withLog()
{
Expand Down

0 comments on commit 8a9964a

Please sign in to comment.