Skip to content

Commit 9093e80

Browse files
committed
some documentation & remove slack notifications
1 parent 0db6957 commit 9093e80

File tree

3 files changed

+78
-78
lines changed

3 files changed

+78
-78
lines changed

README.md

Lines changed: 78 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,27 @@
11
# Blog
2-
A fully develop Blog CRUD package that allows you to manage blogs, using Blog content managing meta data with Tags & Collections.
2+
A fully develop Blog CRUD package that allows you to manage blogs, using Blog content managing meta data with Tags & Collections.
33

4+
**How does this package work?**
5+
This package offers a few aspects and provides a great base for creating a blog page for your project. The main features are:
6+
1. A Blog model with the ability to add tags and make it part of a collection
7+
2. Ability to add more users with author roles (which have default policy rules - which can be overwritten)
8+
3. Built in Factories for easy seeding, development & testing
9+
4. CRUD operations such as Actions, Requests & Controllers to be used - Controllers are coming soon...
10+
11+
12+
**For Future reference**
13+
The main 3 models of this package are:
14+
1. Blog: Containing columns such as `title`, `author_id`, meta related columns and `content` ... and more
15+
2. Tag: A `name` but can be added to a blog (A Blog HasMany Tags) - used to help users understand the base topics of the blog
16+
3. Collection: A `name` and `description` - best used for concepts like a tutorial series (A blog BelongsToOne)
17+
18+
**Example Use Case**
19+
1. A personal blog page which you want an easy implementation for to manage blogs
20+
2. A new blog page where you can add multiple users with restrictions through the author rule + additional roles & policies
21+
22+
**What this package does not offer**
23+
1. At this point in time this package does not offer a set of front end components. This is strictly a laravel crud package.
24+
2. Manage separate users
425

526
## Steps for Development
627
### Installation (via composer)
@@ -17,4 +38,59 @@ Add to your `config/app.php`
1738

1839
### Publishing Migrations
1940
Then to publish the migrations:
20-
`php artisan vendor:publish --tag="blog-crud-migrations"`
41+
`php artisan vendor:publish --tag="blog-crud-migrations"`
42+
43+
### Other Requirements
44+
**File System**
45+
This package does rely on AWS S3 logic when it comes to file uploads, via the Blog Cover or the images you can upload within your blog.
46+
So ensure that your AWS credentials are properly configured, specifically this array within your `config/filesystems`:
47+
```php
48+
's3' => [
49+
'driver' => 's3',
50+
'key' => env('AWS_ACCESS_KEY_ID'),
51+
'secret' => env('AWS_SECRET_ACCESS_KEY'),
52+
'region' => env('AWS_DEFAULT_REGION'),
53+
'bucket' => env('AWS_BUCKET'),
54+
'url' => env('AWS_URL'),
55+
'endpoint' => env('AWS_ENDPOINT'),
56+
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
57+
'throw' => false,
58+
],
59+
```
60+
61+
**Slack Notifications**
62+
63+
## Usage
64+
It is encouraged that you explore this package, it is very straight forward and simple so it is easy to integrate what it has to offer for your use case.
65+
As the logic you implement to use Actions & Requests may be different to others, as well as other practises.
66+
However, lets go over some basic use cases.
67+
68+
### Update a Blog
69+
```php
70+
use App\Http\Controllers\Controller;
71+
use Illuminate\Http\RedirectResponse;
72+
use SethSharp\BlogCrud\Models\Blog\Blog;
73+
use SethSharp\BlogCrud\Actions\Blogs\UpdateBlogAction;
74+
use SethSharp\BlogCrud\Requests\Blogs\UpdateBlogRequest;
75+
76+
class UpdateBlogController extends Controller
77+
{
78+
public function __invoke(Blog $blog, UpdateBlogRequest $updateBlogRequest, UpdateBlogAction $updateBlogAction): RedirectResponse
79+
{
80+
$blog = $updateBlogAction($blog, $updateBlogRequest);
81+
82+
$drafted = (bool)$updateBlogRequest->input('is_draft');
83+
84+
return redirect()
85+
->route('dashboard.blogs.index')
86+
->with('success', $blog->title . ' successfully ' . ($drafted ? 'drafted' : 'published'));
87+
}
88+
}
89+
```
90+
This is an example `UpdateBlogController`, using all the files from the package; `Blog`, `UpdateBlogRequest` & `UpdateBlogAction`.
91+
Reading each of these files will ive you an understanding of what they expect - so its up to you to ensure you pass the correct information.
92+
93+
### Tips
94+
If you wanted to add another column such as `publish_at` to define when to publish the blog through a console command, you just need to define this
95+
attribute by extending the rules in the `UpdateBlogRequest`, then passing that data to `UpdateBlogAction` it will automatically assign that variable. Any
96+
further logic will need to be manually done by yourself.

src/Notifications/NotifySlackOfCommentNotification.php

Lines changed: 0 additions & 42 deletions
This file was deleted.

src/Notifications/NotifySlackOfContactNotification.php

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)