Skip to content

Commit 18b24cb

Browse files
Minor updates
1 parent dc6073e commit 18b24cb

File tree

6 files changed

+24
-12
lines changed

6 files changed

+24
-12
lines changed

.scrutinizer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ checks:
2323
tools:
2424
external_code_coverage:
2525
timeout: 600
26-
runs: 3
26+
runs: 4
2727
php_code_sniffer:
2828
enabled: true
2929
config:

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
language: php
22

3-
sudo: false
4-
53
php:
64
- 7.1.3
75
- 7.1
86
- 7.2
7+
- 7.3
98
- nightly
109

1110
matrix:

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
},
2020
"require-dev": {
2121
"orchestra/testbench": "~3.7.0",
22+
"mockery/mockery": "~1.0",
2223
"phpunit/phpunit": "~7.0",
23-
"phpunit/phpcov": "~5.0",
24-
"mockery/mockery": "~1.0"
24+
"phpunit/phpcov": "~5.0"
2525
},
2626
"autoload": {
2727
"psr-4": {

src/Models/Note.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,20 @@ class Note extends AbstractModel
2929
*
3030
* @var array
3131
*/
32-
protected $fillable = ['content', 'author_id'];
32+
protected $fillable = [
33+
'content',
34+
'author_id',
35+
];
3336

3437
/**
3538
* The attributes excluded from the model's JSON form.
3639
*
3740
* @var array
3841
*/
39-
protected $hidden = ['noteable_id', 'noteable_type'];
42+
protected $hidden = [
43+
'noteable_id',
44+
'noteable_type',
45+
];
4046

4147
/**
4248
* The attributes that should be cast to native types.

src/Traits/HasManyNotes.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,14 @@ public function createNote($content, $author = null, $reload = true)
5050
$this->prepareNoteAttributes($content, $author)
5151
);
5252

53-
$relations = array_merge(['notes'], method_exists($this, 'authoredNotes') ? ['authoredNotes'] : []);
53+
if ($reload) {
54+
$relations = array_merge(
55+
['notes'],
56+
method_exists($this, 'authoredNotes') ? ['authoredNotes'] : []
57+
);
5458

55-
if ($reload) $this->load($relations);
59+
$this->load($relations);
60+
}
5661

5762
return $note;
5863
}
@@ -66,7 +71,7 @@ public function createNote($content, $author = null, $reload = true)
6671
*/
6772
public function findNote($id)
6873
{
69-
return $this->notes()->where('id', $id)->first();
74+
return $this->notes()->find($id);
7075
}
7176

7277
/* -----------------------------------------------------------------

src/Traits/HasOneNote.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,16 @@ public function note()
4343
*/
4444
public function createNote($content, $author = null, $reload = true)
4545
{
46-
if ($this->note) $this->note->delete();
46+
if ($this->note)
47+
$this->note->delete();
4748

4849
/** @var \Arcanedev\LaravelNotes\Models\Note $note */
4950
$note = $this->note()->create(
5051
$this->prepareNoteAttributes($content, $author)
5152
);
5253

53-
if ($reload) $this->load(['note']);
54+
if ($reload)
55+
$this->load(['note']);
5456

5557
return $note;
5658
}

0 commit comments

Comments
 (0)