PHP 클래스 App\Repositories\PostRepository

파일 보기 프로젝트 열기: forehalo/materialize-blog 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$category Category Model
$model Post Model
$tag Tag Model

공개 메소드들

메소드 설명
__construct ( Post $post, Category $category, Tag $tag ) BlogRepository constructor.
all ( integer $n = null, boolean $published = true ) : mixed Get all posts.
body ( $id ) : mixed Get post body.
destroy ( $id ) Destroy a post.
doFavorite ( $id ) Update favorite count
getByColumn ( string $value, string $column = 'id' ) Get post by given column.
parseCategory ( $name ) : mixed Get or create new category and return category id.
parseOrigin ( $origin ) : string Parse Markdown.
search ( $key, integer $pagination = 10 ) : mixed Search in all published posts.
store ( $inputs ) Store new post in database.
update ( $inputs, $id ) Update a post.
updatePublish ( $input, $id ) Update post published status

비공개 메소드들

메소드 설명
savePost ( $post, $inputs ) Store post information in database.
syncTags ( $post, string $tags ) Synchronize post tags relation.

메소드 상세

__construct() 공개 메소드

BlogRepository constructor.
public __construct ( Post $post, Category $category, Tag $tag )
$post app\models\Post
$category app\models\Category
$tag app\models\Tag

all() 공개 메소드

Get all posts.
public all ( integer $n = null, boolean $published = true ) : mixed
$n integer pagination
$published boolean whether fetch unpublished posts.
리턴 mixed

body() 공개 메소드

Get post body.
public body ( $id ) : mixed
$id
리턴 mixed

destroy() 공개 메소드

Destroy a post.
public destroy ( $id )
$id

doFavorite() 공개 메소드

Update favorite count
public doFavorite ( $id )
$id

getByColumn() 공개 메소드

Get post by given column.
public getByColumn ( string $value, string $column = 'id' )
$value string column value.
$column string column name, default={id}

parseCategory() 공개 메소드

Get or create new category and return category id.
public parseCategory ( $name ) : mixed
$name category name
리턴 mixed category id

parseOrigin() 공개 메소드

Parse Markdown.
public parseOrigin ( $origin ) : string
$origin
리턴 string HTML content

store() 공개 메소드

Store new post in database.
public store ( $inputs )
$inputs

update() 공개 메소드

Update a post.
public update ( $inputs, $id )
$inputs
$id post id

updatePublish() 공개 메소드

Update post published status
public updatePublish ( $input, $id )
$input
$id

프로퍼티 상세

$category 보호되어 있는 프로퍼티

Category Model
protected $category

$model 보호되어 있는 프로퍼티

Post Model
protected $model

$tag 보호되어 있는 프로퍼티

Tag Model
protected $tag