PHP 클래스 Corcel\Post

상속: extends Illuminate\Database\Eloquent\Model
파일 보기 프로젝트 열기: jgrossi/corcel 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$appends array The accessors to append to the model's array form.
$dates
$fillable
$postTypes array
$primaryKey
$shortcodes
$table
$with

공개 메소드들

메소드 설명
__construct ( array $attributes = [] )
__get ( string $key ) : string Magic method to return the meta data like the post original fields.
addShortcode ( string $tag, function $function ) Add a shortcode handler
attachment ( ) : Illuminate\Database\Eloquent\Collection Get attachment.
author ( ) : Illuminate\Database\Eloquent\Collection Author relationship.
clearRegisteredPostTypes ( ) Clears any registered post types
comments ( ) : Illuminate\Database\Eloquent\Collection Comments relationship.
fields ( )
getAcfAttribute ( ) : Corcel\Acf\AdvancedCustomFields
getAuthorIdAttribute ( ) : integer Gets the author id attribute.
getContentAttribute ( ) : string Gets the content attribute.
getCreatedAtAttribute ( ) : date Gets the created at attribute.
getExcerptAttribute ( ) : string Gets the excerpt attribute.
getFormat ( ) : boolean | string Get the post format, like the WP get_post_format() function
getImageAttribute ( ) : string Gets the featured image if any Looks in meta the _thumbnail_id field.
getKeywordsAttribute ( ) : array Gets the keywords as array.
getKeywordsStrAttribute ( ) : string Gets the keywords as string.
getMainCategoryAttribute ( ) : string Gets the first term of the first taxonomy found.
getMimeTypeAttribute ( ) : string Gets the mime type attribute.
getParentIdAttribute ( ) : integer Gets the parent id attribute.
getSlugAttribute ( ) : string Gets the slug attribute.
getStatusAttribute ( ) : string Gets the status attribute.
getTermsAttribute ( ) : array Gets all the terms arranged taxonomy => terms[].
getTitleAttribute ( ) : string Gets the title attribute.
getTypeAttribute ( ) : string Gets the type attribute.
getUpdatedAtAttribute ( ) : date Gets the updated at attribute.
getUrlAttribute ( ) : string Gets the url attribute.
hasTerm ( string $taxonomy, string $term ) : boolean Whether the post contains the term or not.
meta ( ) : Corcel\PostMetaCollection Meta data relationship.
newFromBuilder ( array $attributes = [], null $connection = null ) : mixed Overrides default behaviour by instantiating class based on the $attributes->post_type value
newQuery ( boolean $excludeDeleted = true ) : Corcel\PostBuilder Overriding newQuery() to the custom PostBuilder with some interesting methods.
parent ( ) : Corcel\Post Parent post.
registerPostType ( string $name, string $class ) Register your Post Type classes here to have them be instantiated instead of the standard Post model
removeShortcode ( string $tag ) Removes a shortcode handler
revision ( ) : Illuminate\Database\Eloquent\Collection Get revisions from post.
save ( array $options = [] )
scopeHasMeta ( $query, $meta, null $value = null ) : Illuminate\Database\Eloquent\Collection Meta filter scope.
stripShortcodes ( string $content ) : string Process the shortcodes
taxonomies ( ) : Illuminate\Database\Eloquent\Collection Taxonomy relationship.
thumbnail ( ) Return the post thumbnail

메소드 상세

__construct() 공개 메소드

public __construct ( array $attributes = [] )
$attributes array

__get() 공개 메소드

Magic method to return the meta data like the post original fields.
public __get ( string $key ) : string
$key string
리턴 string

addShortcode() 공개 정적인 메소드

Add a shortcode handler
public static addShortcode ( string $tag, function $function )
$tag string the shortcode tag
$function function the shortcode handling function

attachment() 공개 메소드

Get attachment.
public attachment ( ) : Illuminate\Database\Eloquent\Collection
리턴 Illuminate\Database\Eloquent\Collection

author() 공개 메소드

Author relationship.
public author ( ) : Illuminate\Database\Eloquent\Collection
리턴 Illuminate\Database\Eloquent\Collection

clearRegisteredPostTypes() 공개 정적인 메소드

Clears any registered post types
public static clearRegisteredPostTypes ( )

comments() 공개 메소드

Comments relationship.
public comments ( ) : Illuminate\Database\Eloquent\Collection
리턴 Illuminate\Database\Eloquent\Collection

fields() 공개 메소드

public fields ( )

getAcfAttribute() 공개 메소드

public getAcfAttribute ( ) : Corcel\Acf\AdvancedCustomFields
리턴 Corcel\Acf\AdvancedCustomFields

getAuthorIdAttribute() 공개 메소드

Gets the author id attribute.
public getAuthorIdAttribute ( ) : integer
리턴 integer

getContentAttribute() 공개 메소드

Gets the content attribute.
public getContentAttribute ( ) : string
리턴 string

getCreatedAtAttribute() 공개 메소드

Gets the created at attribute.
public getCreatedAtAttribute ( ) : date
리턴 date

getExcerptAttribute() 공개 메소드

Gets the excerpt attribute.
public getExcerptAttribute ( ) : string
리턴 string

getFormat() 공개 메소드

Get the post format, like the WP get_post_format() function
public getFormat ( ) : boolean | string
리턴 boolean | string

getImageAttribute() 공개 메소드

Gets the featured image if any Looks in meta the _thumbnail_id field.
public getImageAttribute ( ) : string
리턴 string

getKeywordsAttribute() 공개 메소드

Gets the keywords as array.
public getKeywordsAttribute ( ) : array
리턴 array

getKeywordsStrAttribute() 공개 메소드

Gets the keywords as string.
public getKeywordsStrAttribute ( ) : string
리턴 string

getMainCategoryAttribute() 공개 메소드

Gets the first term of the first taxonomy found.
public getMainCategoryAttribute ( ) : string
리턴 string

getMimeTypeAttribute() 공개 메소드

Gets the mime type attribute.
public getMimeTypeAttribute ( ) : string
리턴 string

getParentIdAttribute() 공개 메소드

Gets the parent id attribute.
public getParentIdAttribute ( ) : integer
리턴 integer

getSlugAttribute() 공개 메소드

Gets the slug attribute.
public getSlugAttribute ( ) : string
리턴 string

getStatusAttribute() 공개 메소드

Gets the status attribute.
public getStatusAttribute ( ) : string
리턴 string

getTermsAttribute() 공개 메소드

Gets all the terms arranged taxonomy => terms[].
public getTermsAttribute ( ) : array
리턴 array

getTitleAttribute() 공개 메소드

Gets the title attribute.
public getTitleAttribute ( ) : string
리턴 string

getTypeAttribute() 공개 메소드

Gets the type attribute.
public getTypeAttribute ( ) : string
리턴 string

getUpdatedAtAttribute() 공개 메소드

Gets the updated at attribute.
public getUpdatedAtAttribute ( ) : date
리턴 date

getUrlAttribute() 공개 메소드

Gets the url attribute.
public getUrlAttribute ( ) : string
리턴 string

hasTerm() 공개 메소드

Whether the post contains the term or not.
public hasTerm ( string $taxonomy, string $term ) : boolean
$taxonomy string
$term string
리턴 boolean

meta() 공개 메소드

Meta data relationship.
public meta ( ) : Corcel\PostMetaCollection
리턴 Corcel\PostMetaCollection

newFromBuilder() 공개 메소드

By default, this method will always return an instance of the calling class. However if post types have been registered with the Post class using the registerPostType() static method, this will now return an instance of that class instead. If the post type string from $attributes->post_type does not appear in the static $postTypes array, then the class instantiated will be the called class (the default behaviour of this method).
public newFromBuilder ( array $attributes = [], null $connection = null ) : mixed
$attributes array
$connection null
리턴 mixed

newQuery() 공개 메소드

Overriding newQuery() to the custom PostBuilder with some interesting methods.
public newQuery ( boolean $excludeDeleted = true ) : Corcel\PostBuilder
$excludeDeleted boolean
리턴 Corcel\PostBuilder

parent() 공개 메소드

Parent post.
public parent ( ) : Corcel\Post
리턴 Corcel\Post

registerPostType() 공개 정적인 메소드

This method allows you to register classes that will be used for specific post types as defined in the post_type column of the wp_posts table. If a post type is registered here, when a Post object is returned from the posts table it will be automatically converted into the appropriate class for its post type. If you register a Page class for the post_type 'page', then whenever a Post is fetched from the database that has its post_type has 'page', it will be returned as a Page instance, instead of the default and generic Post instance.
public static registerPostType ( string $name, string $class )
$name string The name of the post type (e.g. 'post', 'page', 'custom_post_type')
$class string The class that represents the post type model (e.g. 'Post', 'Page', 'CustomPostType')

removeShortcode() 공개 정적인 메소드

Removes a shortcode handler
public static removeShortcode ( string $tag )
$tag string the shortcode tag

revision() 공개 메소드

Get revisions from post.
public revision ( ) : Illuminate\Database\Eloquent\Collection
리턴 Illuminate\Database\Eloquent\Collection

save() 공개 메소드

public save ( array $options = [] )
$options array

scopeHasMeta() 공개 메소드

Meta filter scope.
public scopeHasMeta ( $query, $meta, null $value = null ) : Illuminate\Database\Eloquent\Collection
$query
$meta
$value null
리턴 Illuminate\Database\Eloquent\Collection

stripShortcodes() 공개 메소드

Process the shortcodes
public stripShortcodes ( string $content ) : string
$content string the content
리턴 string

taxonomies() 공개 메소드

Taxonomy relationship.
public taxonomies ( ) : Illuminate\Database\Eloquent\Collection
리턴 Illuminate\Database\Eloquent\Collection

thumbnail() 공개 메소드

Return the post thumbnail
public thumbnail ( )

프로퍼티 상세

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

The accessors to append to the model's array form.
protected array $appends
리턴 array

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

protected $dates

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

protected $fillable

$postTypes 보호되어 있는 정적으로 프로퍼티

protected static array $postTypes
리턴 array

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

protected $primaryKey

$shortcodes 보호되어 있는 정적으로 프로퍼티

protected static $shortcodes

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

protected $table

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

protected $with