imagina / iblog-module
Installs: 2 854
Dependents: 2
Suggesters: 0
Security: 0
Stars: 1
Watchers: 5
Forks: 10
Open Issues: 0
Language:Blade
Type:asgard-module
Requires
- php: ^8.1
- cviebrock/eloquent-sluggable: ^8.0|^9.0|^10.0
- imagina/core-module: ^10.0
- imagina/ihelpers-module: ^10.0
Requires (Dev)
- orchestra/testbench: ^8.5
- phpunit/phpunit: ^10
- v10.x-dev
- 10.0.0
- v8.x-dev
- 4.0.x-dev
- dev-master / 4.0.x-dev
- 4.0.27
- 4.0.26
- 4.0.25
- 4.0.24
- 4.0.23
- 4.0.22
- 4.0.21
- 4.0.20
- 4.0.19
- 4.0.18
- 4.0.17
- 4.0.16
- 4.0.15
- 4.0.14
- 4.0.13
- 4.0.12
- 4.0.11
- 4.0.10
- 4.0.9
- 4.0.8
- 4.0.7
- 4.0.6
- 4.0.5
- 4.0.4
- 4.0.3
- 4.0.1
- 4.0.0
- 3.1.x-dev
- 3.1.4
- 3.1.3
- 3.1.2
- 3.1.1
- 3.1.0
- 3.0.x-dev
- 3.0.5
- 3.0.4
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- 2.0.x-dev
- 2.0.0
- dev-dev-tenant
- dev-slim-v8
- dev-dev
- dev-@dev
This package is auto-updated.
Last update: 2024-10-23 13:58:55 UTC
README
The Blog module allows authorized users to maintain a blog. Blogs are a series of posts that are time stamped and are typically viewed by date as you would view a journal. Blog entries can be made public or private to the site members, depending on which roles have access to view content.
Installation
composer require imagina/iblog-module
php artisan module:migrate Iblog
End Points
Route Base: https://yourhost.com/api/iblog/v1/
-
Post
-
Attributes
- title: string (Translatable)
- description: string (Translatable)
- slug: string (Translatable)
- summary: string (Translatable)
- meta_title: string (Translatable)
- meta_description: string (Translatable)
- meta_keywords: string (Translatable)
- translatable_options: string (Translatable)
- options: string
- category_id: string
- categories: array
- tags: array
- user_id: string
- status: string
- created_at: string
-
Create
- Method:
POST
- URI:
/posts
- Method:
-
Read
- Method:
GET
- URI:
/posts/:id
- URI:
/posts
- Method:
-
Update
- Method:
PUT
- URI:
/post/:id
- Method:
-
Delete
- Method:
DELETE
- URI:
/posts/:id
- Method:
-
-
Categories
-
Attributes
- parent_id: Integer
- options: Text
- title: String (Translatable)
- slug: String (Translatable)
- description: Text (Translatable)
- meta_title: Text (Translatable)
- meta_description: Text (Translatable)
- translatable_options: Text (Translatable)
-
Create
- Method:
POST
- URI:
/categories
- Method:
-
Read
- Method:
GET
- URI:
/categories/:id
- URI:
/categories
- Method:
-
Update
- Method:
PUT
- URI:
/categories/:id
- Method:
-
Delete
- Method:
DELETE
- URI:
/categories/:id
- Method:
-
Setting up relations
For establish relationships with other modules since we cannot edit our Iblog module directly, since this module is managed by the composer; we need to edit the config.php
file in the folder /config/asgard/iblog/
of our application.
Navigate to the section titled Dynamic Relationships, by default it looks like this:
'relations' => [
'category'=>[
'store' => function () {
return $this->belongsTo(
\Modules\Marketplace\Entities\Store::class);
},
],
'post'=>[
'store' => function () {
return $this->belongsTo(
\Modules\Marketplace\Entities\Store::class);
},
],
]
Now we can access the information of the iblog Post or Category using $post->store->name
o $category->store->name
respectively.
Add data in Post or Category table You can add additional columns in the category or post table if really necessary. For example, if you want to add a relation column or an additional query field. We need to edit the config.php file in the /config/asgard/iblog/ folder of our application. there's a fillable key which contains an array of fillable fields for the object.
/*
|--------------------------------------------------------------------------
| Fillable user fields
|--------------------------------------------------------------------------
| Set the fillable post and category fields, those fields will be mass assigned
*/
'fillable' => [
'post'=>[
'options',
'category_id',
'user_id',
'status',
'created_at'
],
'category'=>[
'parent_id',
'options'
]
],
Add the fields you want in this array.
/*
|--------------------------------------------------------------------------
| Fillable user fields
|--------------------------------------------------------------------------
| Set the fillable post and category fields, those fields will be mass assigned
*/
'fillable' => [
'post'=>[
'options',
'category_id',
'user_id',
'status',
'created_at',
'store_id'
],
'category'=>[
'parent_id',
'options',
'store_id'
]
],