Skip to content

Commit cce8745

Browse files
committed
Update Readme and install command.
1 parent 3764b56 commit cce8745

File tree

4 files changed

+63
-57
lines changed

4 files changed

+63
-57
lines changed

README.md

+61-57
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
## Modular's Blog Module
1717

18-
The Modular Blog Module is a Blog Module for Applications built using the [Modular Project](https://docs.ismodular.com).
18+
The Modular Blog Module is a comprehensive solution for adding a blog to applications built with the [Modular Project](https://docs.ismodular.com).
1919

2020
It has the following features:
2121

@@ -24,13 +24,15 @@ It has the following features:
2424
- Tags Management
2525
- Authors Management
2626

27-
This means that you can easily create posts using a Fully Featured WYSIWYG Editor, and manage them using a simple and intuitive interface to create, edit, and delete posts, categories, tags, and authors, also allowing you to manage the posts' status and visibility throught publication dates.
27+
This means that you can easily create posts using a Fully Featured WYSIWYG Editor, and manage them using a simple and intuitive interface to create, edit, and delete posts, categories, tags, and authors, also allowing you to manage the posts' status and visibility through publication dates.
2828

2929
## Preparing to install the Modular Blog Module
3030

31-
Before installing the Modular Blog Module, you need to make sure that you have the Modular Project installed and configured in your Laravel Application. If you haven't done that yet, you can follow the [Modular Project's Installation Guide](https://docs.ismodular.com/getting-started.html).
31+
Before installing the Modular Blog Module, please ensure the following steps are completed:
3232

33-
With the Modular Project installed, follow the steps to [Publish Site Files](https://docs.ismodular.com/essentials/site-setup.html).
33+
1. **Modular Project Installation**: Confirm that the Modular Project is installed and configured in your Laravel application. If this step is incomplete, please consult the [Modular Project's Installation Guide](https://docs.ismodular.com/getting-started.html) for assistance.
34+
35+
2. **Site Files Publication**: With the Modular Project set up, proceed to [Publish Site Files](https://docs.ismodular.com/essentials/site-setup.html) as outlined in the documentation. This step is crucial for successfully integrating the Modular Blog Module.
3436

3537
Now that you have all set, proceed to install the Modular Blog Module.
3638

@@ -42,81 +44,57 @@ To install the Modular Blog Module, you need to require it using Composer:
4244
composer require daniel-cintra/modular-blog
4345
```
4446

45-
After that, you can run the module's installation command:
47+
Then, initiate the module installation:
4648

4749
```bash
4850
php artisan modular:blog-install
4951
```
5052

51-
This command will publish the module's files required for the module to work, and also run the module's migrations and optionally seed the database with some default data.
53+
This action publishes essential files and runs migrations, with an option to seed the database with default data.
54+
55+
```bash
56+
php artisan storage:link
57+
```
5258

5359
### Check npm dependencies
5460

55-
The Blog Module has a dependency on the Pinia npm package. If you don't have it installed, follow these steps:
61+
The Blog Module has a dependency on the [Pinia Store](https://pinia.vuejs.org/) npm package. If you don't have it installed in your project, follow these steps:
5662

5763
1 - On your project root run:
5864

5965
```bash
6066
npm install -D pinia
6167
```
6268

63-
2 - Open the file `resources/js/app.js` and add the pinia `import { createPinia } from 'pinia'` and the `.use(createPinia())` blocks.
69+
2 - Open the file `resources/js/app.js` and add the Pinia `import { createPinia } from 'pinia'` and the `.use(createPinia())` blocks.
6470

6571
```js
66-
import '../css/app.css'
67-
import 'remixicon/fonts/remixicon.css'
68-
69-
import { createApp, h } from 'vue'
72+
...
7073
import { createPinia } from 'pinia'
71-
import { createInertiaApp } from '@inertiajs/vue3'
72-
import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers'
73-
import { ZiggyVue } from '../../vendor/tightenco/ziggy/dist/vue.m'
74-
75-
const appName = import.meta.env.VITE_APP_NAME || 'Laravel'
76-
77-
// global components
78-
import { Link } from '@inertiajs/vue3'
79-
import Layout from './Layouts/AuthenticatedLayout.vue'
80-
81-
import Translations from '@/Plugins/Translations'
8274

8375
createInertiaApp({
84-
title: (title) => `${title} - ${appName}`,
85-
resolve: (name) => {
86-
const page = resolvePageComponent(
87-
`./Pages/${name}.vue`,
88-
import.meta.glob('./Pages/**/*.vue')
89-
)
90-
91-
page.then((module) => {
92-
module.default.layout = module.default.layout || Layout
93-
})
94-
95-
return page
96-
},
76+
...
9777
setup({ el, App, props, plugin }) {
9878
return createApp({ render: () => h(App, props) })
9979
.use(createPinia())
10080
.use(plugin)
101-
.use(ZiggyVue, Ziggy)
102-
.use(Translations)
103-
.component('Link', Link)
104-
.mount(el)
105-
},
106-
progress: {
107-
color: '#3e63dd'
81+
...
10882
}
10983
})
11084
```
11185

112-
Here are the manual configuration needed to finish the Blog Installation:
86+
## Final Configuration Steps
11387

11488
### 1 - BlogServiceProvider
11589

11690
Add the BlogServiceProvider to `/config/app.php`
11791

11892
```php
119-
Modules\Blog\BlogServiceProvider::class,
93+
'providers' => ServiceProvider::defaultProviders()->merge([
94+
...
95+
Modules\Blog\BlogServiceProvider::class,
96+
97+
])->toArray(),
12098
```
12199

122100
### 2 - Backend Menu Items
@@ -166,7 +144,7 @@ export default {
166144

167145
### 3 - Frontend
168146

169-
In `vite.config.js` manually add the module entry to:
147+
In `vite.config.js` manually add the `resources-site/js/blog-app.js` entry to the laravel plugin `input` array:
170148

171149
```js
172150
plugins: [
@@ -182,21 +160,46 @@ plugins: [
182160
],
183161
```
184162

185-
That's it. The Blog Module should be fully functional at this stage.
163+
With the installation steps completed as outlined, the Blog Module should now be fully operational within your application. This marks the completion of the setup process, enabling you to start using the module's features for managing and publishing blog content.
164+
165+
### Compiling the assets
166+
167+
To view the changes on your project run:
168+
169+
```bash
170+
npm run dev
171+
```
172+
173+
#### Blog CMS
174+
175+
To access the Blog Module's CMS (Content Management System), login in to the Modular CMS using the configured path in your `config/modular.php` file in the `login-url` key (for example `/admin`). The Blog Management links will be listed in the sidebar menu.
176+
177+
<img src="art/modular-blog-cms.jpg" alt="Modular Blog Index" style="width: 100%;">
178+
179+
#### Blog Site View
180+
181+
By default, you can access the blog posts controller in the `/blog` route registered by the module.
182+
183+
<img src="art/modular-blog-index.jpg" alt="Modular Blog Index" style="width: 100%;">
186184

187185
### Blog Seeders (Optional Step)
188186

189-
The Blog Module has two built in Seeders:
187+
The Blog Module includes two built-in seeders:
188+
189+
1. **BlogSeeder**: This seeder populates your database with `posts`, `authors`, `categories`, and `tags`. It also fetches images online to enrich `posts`, `authors`, and `categories`. Since it retrieves images from the internet, the seeding process may take a few seconds. A progress bar indicator is included within the Seeder, allowing you to monitor the progress of the operation.
190+
191+
2. **BlogAclSeeder**: This seeder creates the Access Control List (ACL) Permissions related to the Blog Module. These permissions can then be associated with the desired `ACL Role` through the application's interface, facilitating the management of user permissions within the blog module.
190192

191-
1 - **BlogSeeder**: Will create `posts`, `authors`, `categories` and `tags`. It will fetch images online to populate `posts`, `authors` and `categories`, so it can take a few seconds to complete.
193+
You have the option to manually run the seeders or include them in the `database/seeders/DatabaseSeeder.php` file for automatic execution. This flexibility allows you to tailor the seeding process to your application's needs, ensuring that the Blog Module is populated with initial data or configured with the necessary ACL permissions as part of your project's overall database seeding strategy.
192194

193-
2 - **BlogAclSeeder**: Will create the ACL Permissions associated with the module, so it can be associated with the desired `ACL Role` through the App Interface.
195+
#### Adding the Seeders to the DatabaseSeeder File
194196

195-
You can manually run the seeders or you can add the seeders to be executed in the `database/seeders/DatabaseSeeder.php` file.
197+
To integrate the seeders with your application's seeding process, add them to the `DatabaseSeeder.php` file located in `database/seeders`. Here's how to do it:
196198

197-
#### Adding the seeders to the DatabaseSeeder file
199+
1. Import the `BlogSeeder` and `BlogAclSeeder` at the top of your `DatabaseSeeder.php` file.
200+
2. Inside the `run` method of your `DatabaseSeeder`, invoke the seeders by calling their respective `run` methods.
198201

199-
To add the seeders to the main DatabaseSeeder file, import the BlogSeeders and call them inside the `run` method:
202+
This setup ensures that when you run the database seeding command, both the BlogSeeder and BlogAclSeeder are executed, populating your database with initial blog data and setting up ACL permissions accordingly.
200203

201204
```php
202205
<?php
@@ -212,23 +215,24 @@ public function run(): void
212215
$this->call(BlogAclSeeder::class);
213216
$this->call(BlogSeeder::class);
214217
}
215-
216218
```
217219

218220
#### Manually executing the Seeders
219221

220-
To manually execute the Seeders you can run:
222+
To manually run the seeders, execute the following commands in your terminal:
223+
224+
For the `BlogSeeder`:
221225

222226
```bash
223227
php artisan db:seed --class="Modules\\Blog\\Database\\Seeders\\BlogSeeder"
224228
```
225229

226-
And also:
230+
And for the `BlogAclSeeder`:
227231

228232
```bash
229233
php artisan db:seed --class="Modules\\Blog\\Database\\Seeders\\BlogAclSeeder"
230234
```
231-
235+
These commands allow you to selectively seed your database with the blog module's content and ACL permissions, offering a more controlled setup process.
232236

233237
## License
234238

art/modular-blog-cms.jpg

113 KB
Loading

art/modular-blog-index.jpg

163 KB
Loading

src/Console/InstallCommand.php

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ public function handle(): void
1818
$this->copyResourcesSiteFiles();
1919
$this->copyResourcesComponentsFiles();
2020

21+
$this->call('storage:link');
22+
2123
$this->info('Modular Blog installed successfully.');
2224
$this->info('Running the following command to migrate the Blog module:');
2325

0 commit comments

Comments
 (0)