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
Copy file name to clipboardExpand all lines: _docs/3.Usage.md
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,9 @@
2
2
3
3
## Table of contents
4
4
5
-
1.[Installation and Setup](1-Installation-and-Setup.md)
6
-
2.[Configuration](2-Configuration.md)
7
-
3.[Usage](3-Usage.md)
5
+
1.[Installation and Setup](1.Installation-and-Setup.md)
6
+
2.[Configuration](2.Configuration.md)
7
+
3.[Usage](3.Usage.md)
8
8
9
9
First things first, edit your eloquent model by using the `Arcanedev\LaravelNotes\Traits\HasManyNotes` trait.
10
10
@@ -16,7 +16,7 @@ use Illuminate\Database\Eloquent\Model;
16
16
17
17
class Post extends Model {
18
18
use HasManyNotes;
19
-
19
+
20
20
// Other stuff ...
21
21
}
22
22
```
@@ -31,9 +31,9 @@ You can call the `createNote()` method on your Eloquent model like below:
31
31
$post = App\Post::first();
32
32
$note = $post->createNote('Hello world #1');
33
33
```
34
-
34
+
35
35
#### Add With a Author/ User
36
-
36
+
37
37
```php
38
38
$user = App\User::first();
39
39
$post = App\Post::first();
@@ -50,9 +50,9 @@ use Illuminate\Database\Eloquent\Model;
50
50
51
51
class Post extends Model {
52
52
use HasManyNotes;
53
-
53
+
54
54
// Other stuff ...
55
-
55
+
56
56
/**
57
57
* Get the current author's id.
58
58
*
@@ -66,16 +66,16 @@ class Post extends Model {
66
66
```
67
67
68
68
#### Getting Notes
69
-
69
+
70
70
```php
71
71
$post = App\Post::first();
72
72
$notes = $post->notes;
73
73
```
74
-
74
+
75
75
> **NOTE :**`$post->notes` relation property is only available in the `HasManyNotes` trait. If you're using `HasOneNote` trait, use `$post->note` instead.
76
76
77
-
#### Getting the author's notes
78
-
77
+
#### Getting the author's notes
78
+
79
79
You can also retrieve all the author's notes by using the `Arcanedev\LaravelNotes\Traits\AuthoredNotes` Trait in your User model (for example).
0 commit comments