2017 © Pedro Peláez
 

asgard-module iblog-module

image

imagina/iblog-module

  • Thursday, February 8, 2018
  • by imagina
  • Repository
  • 1 Watchers
  • 0 Stars
  • 103 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 10 Versions
  • 24 % Grown

The README.md

Blog Module 4.0

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., (*1)

Installation

  • composer require imagina/iblog-module
  • php artisan module:migrate Iblog

End Points

Route Base: https://yourhost.com/api/iblog/v1/, (*2)

  • Post

    • Attributes, (*3)

      • 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, (*4)

      • Method: POST
      • URI: /posts
    • Read, (*5)

      • Method: GET
      • URI: /posts/:id
      • URI: /posts
    • Update, (*6)

      • Method: PUT
      • URI: /post/:id
    • Delete, (*7)

      • Method: DELETE
      • URI: /posts/:id
  • Categories

    • Attributes, (*8)

      • 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, (*9)

      • Method: POST
      • URI: /categories
    • Read, (*10)

      • Method: GET
      • URI: /categories/:id
      • URI: /categories
    • Update, (*11)

      • Method: PUT
      • URI: /categories/:id
    • Delete, (*12)

      • Method: DELETE
      • URI: /categories/:id

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., (*13)

Navigate to the section titled Dynamic Relationships, by default it looks like this:, (*14)

'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., (*15)

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., (*16)

  /*
    |--------------------------------------------------------------------------
    | 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., (*17)

  /*
    |--------------------------------------------------------------------------
    | 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'
        ]
    ],

The Versions

08/02 2018

3.0.x-dev

3.0.9999999.9999999-dev

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dev Imagina

08/02 2018

3.0.5

3.0.5.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dev Imagina

24/01 2018

3.0.4

3.0.4.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dev Imagina

05/01 2018

3.0.2

3.0.2.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dev Imagina

05/01 2018

3.0.3

3.0.3.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dev Imagina

27/09 2017

3.0.1

3.0.1.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dev Imagina

26/09 2017

3.0.0

3.0.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dev Imagina

26/09 2017

2.0.x-dev

2.0.9999999.9999999-dev

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dev Imagina

11/08 2017

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dev Imagina

11/08 2017

2.0.0

2.0.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dev Imagina