@@ -11,6 +11,12 @@ This package is a blogging database with maxed out models, migrations and seeder
11
11
Here are some code examples:
12
12
13
13
``` php
14
+ // Alias namespace path:
15
+ // Chriscreates\Blog\Post
16
+ // Chriscreates\Blog\Category
17
+ // Chriscreates\Blog\Tag
18
+ // Chriscreates\Blog\Comment
19
+
14
20
// Search by the short whereCategories method OR use whereCategory() and specify the field
15
21
$results = Post::whereCategories($categories = null)->get();
16
22
$results = Post::whereCategory($field, $operator, $value)->get();
@@ -77,19 +83,14 @@ composer require chrisjk123/laravel-blogger
77
83
You can publish the migrations with:
78
84
79
85
``` bash
80
- php artisan vendor:publish --provider=" Chriscreate\Blog\BloggerServiceProvider" --tag=" migrations"
81
- ```
82
-
83
- Publish the migrations:
84
-
85
- ``` bash
86
+ php artisan vendor:publish --provider=" Chriscreates\Blog\BloggerServiceProvider" --tag=" migrations"
86
87
php artisan migrate
87
88
```
88
89
89
90
You can optionally publish the config file with:
90
91
91
92
``` bash
92
- php artisan vendor:publish --provider=" Chriscreate \Blog\BloggerServiceProvider" --tag=" config"
93
+ php artisan vendor:publish --provider=" Chriscreates \Blog\BloggerServiceProvider" --tag=" config"
93
94
```
94
95
95
96
This is the contents of the published config file, if your ` User ` class is
@@ -103,29 +104,25 @@ return [
103
104
'user_class' => \App\User::class,
104
105
'user_key_name' => 'id',
105
106
];
106
-
107
107
```
108
108
109
- You can publish the factories with:
109
+ ## Local testing
110
110
111
- ``` bash
112
- php artisan vendor:publish --provider=" Chriscreate\Blog\BloggerServiceProvider" --tag=" factories"
113
- ```
114
-
115
- You can publish the seeder with:
111
+ You can publish the factories with:
116
112
117
113
``` bash
118
- php artisan vendor:publish --provider=" Chriscreate\Blog\BloggerServiceProvider" --tag=" seeders"
114
+ php artisan vendor:publish --provider=" Chriscreates\Blog\BloggerServiceProvider" --tag=" factories"
115
+ php artisan vendor:publish --provider=" Chriscreates\Blog\BloggerServiceProvider" --tag=" seeders"
119
116
```
120
117
121
- ## Documentation
118
+ ## Usage
122
119
123
120
All you have to do is add the ` HasPosts ` to your User model to get started.
124
121
125
122
``` php
126
123
namespace App;
127
124
128
- use Chriscreate \Blog\Traits\User\HasPosts;
125
+ use Chriscreates \Blog\Traits\User\HasPosts;
129
126
use Illuminate\Foundation\Auth\User as Authenticatable;
130
127
use Illuminate\Notifications\Notifiable;
131
128
@@ -136,13 +133,13 @@ class User extends Authenticatable
136
133
// ...
137
134
}
138
135
139
-
140
136
// Retrieve the posts created by the user(s)
141
137
$user->posts;
142
138
143
139
// Retrieve the comments created by the user(s)
144
140
$user->comments;
145
141
```
142
+
146
143
### Changelog
147
144
148
145
Please see [ CHANGELOG] ( CHANGELOG.md ) for more information what has changed recently.
0 commit comments