Skip to content
Nemanja Maric edited this page Oct 3, 2016 · 9 revisions

Your can access our package Blog instance simple typing build in SLA facade accelerator

So simple when your type SLA::blog()->posts() or SLA::blog()->categories() or SLA::blog()->comments() we while return you a Query Builder.

If you don't send brackets at the end of the method we while returning you Collection.

Posts

SLA::blog()->posts() your get Query Builder so your have a basic idea how it work.

In case your writing Post outside our panel here is the list available column:

SLA::blog()->posts()->create([
    'blog_category_id', (int default(null))
    'uri_id', (string)
    'title', (string)
    'thumb', (string)
    'content', (string)
    'excerpt', (string)
    'visible', (int default(0))
    'meta_title', (string)
    'meta_description', (text)
    'meta_keywords', (string)
]);

Get all comments for single post

SLA::blog()->posts()->find($post_id)->comments return you a relationship hasMany.

Get Category for single post

SLA::blog()->posts()->find($post_id)->categories return you a relationship belongsTo.

Comments

SLA::blog()->comments() your get Query Builder same as SLA::blog()->posts()

Get post for single comment

SLA::blog()->comments()->find($comment_id)->article return you a relationship belongsTo.

Write comment to post

SLA::blog()->comments()->create([
    'blog_post_id', (int)
    'name', (string)
    'email', (string)
    'content', (text)
    'approved', (int) (default 0)
});

Category

SLA::blog()->categories() your get Query Builder same as SLA::blog()->posts()

Clone this wiki locally