PHP 클래스 RainLab\Blog\Models\Post

상속: extends Mode\Model, use trait October\Rain\Database\Traits\Validation
파일 보기 프로젝트 열기: rainlab/blog-plugin 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$allowedSortingOptions array The attributes on which the post list can be ordered
$attachMany
$belongsTo * Relations
$belongsToMany
$implement
$preview
$rules * Validation
$table
$translatable Attributes that support translation, if available.

보호된 프로퍼티들

프로퍼티 타입 설명
$appends The accessors to append to the model's array form.
$dates array The attributes that should be mutated to dates.

공개 메소드들

메소드 설명
afterValidate ( )
beforeSave ( )
canEdit ( Backend\Models\User $user ) : boolean Used to test if a certain user has permission to edit post, returns TRUE if the user is the owner or has other posts access.
filterFields ( $fields, $context = null ) : void Limit visibility of the published-button
formatHtml ( $input, $preview = false )
getHasSummaryAttribute ( ) : boolean Used by "has_summary", returns true if this post uses a summary (more tag)
getMenuTypeInfo ( string $type ) : array Handler for the pages.menuitem.getTypeInfo event.
getSummaryAttribute ( ) : string Used by "summary", if no excerpt is provided, generate one from the content.
resolveMenuItem ( RainLab\Pages\Classes\MenuItem $item, string $url, Cms\Classes\Theme $theme ) : mixed Handler for the pages.menuitem.resolveItem event.
scopeFilterCategories ( Illuminate\Query\Builder $query, array $categories ) : Illuminate\Query\Builder Allows filtering for specifc categories
scopeIsPublished ( $query )
scopeListFrontEnd ( $query, array $options ) : self Lists posts for the front end
setUrl ( string $pageName, Cms\Classes\Controller $controller ) Sets the "url" attribute with a URL to this object

보호된 메소드들

메소드 설명
getPostPageUrl ( $pageCode, $category, $theme ) Returns URL of a post page.

메소드 상세

afterValidate() 공개 메소드

public afterValidate ( )

beforeSave() 공개 메소드

public beforeSave ( )

canEdit() 공개 메소드

Used to test if a certain user has permission to edit post, returns TRUE if the user is the owner or has other posts access.
public canEdit ( Backend\Models\User $user ) : boolean
$user Backend\Models\User
리턴 boolean

filterFields() 공개 메소드

Limit visibility of the published-button
public filterFields ( $fields, $context = null ) : void
리턴 void

formatHtml() 공개 정적인 메소드

public static formatHtml ( $input, $preview = false )

getHasSummaryAttribute() 공개 메소드

Used by "has_summary", returns true if this post uses a summary (more tag)
public getHasSummaryAttribute ( ) : boolean
리턴 boolean

getMenuTypeInfo() 공개 정적인 메소드

Returns a menu item type information. The type information is returned as array with the following elements: - references - a list of the item type reference options. The options are returned in the ["key"] => "title" format for options that don't have sub-options, and in the format ["key"] => ["title"=>"Option title", "items"=>[...]] for options that have sub-options. Optional, required only if the menu item type requires references. - nesting - Boolean value indicating whether the item type supports nested items. Optional, false if omitted. - dynamicItems - Boolean value indicating whether the item type could generate new menu items. Optional, false if omitted. - cmsPages - a list of CMS pages (objects of the Cms\Classes\Page class), if the item type requires a CMS page reference to resolve the item URL.
public static getMenuTypeInfo ( string $type ) : array
$type string Specifies the menu item type
리턴 array Returns an array

getPostPageUrl() 보호된 정적인 메소드

Returns URL of a post page.
protected static getPostPageUrl ( $pageCode, $category, $theme )

getSummaryAttribute() 공개 메소드

Returns the HTML content before the tag or a limited 600 character version.
public getSummaryAttribute ( ) : string
리턴 string

resolveMenuItem() 공개 정적인 메소드

Returns information about a menu item. The result is an array with the following keys: - url - the menu item URL. Not required for menu item types that return all available records. The URL should be returned relative to the website root and include the subdirectory, if any. Use the Url::to() helper to generate the URLs. - isActive - determines whether the menu item is active. Not required for menu item types that return all available records. - items - an array of arrays with the same keys (url, isActive, items) + the title key. The items array should be added only if the $item's $nesting property value is TRUE.
public static resolveMenuItem ( RainLab\Pages\Classes\MenuItem $item, string $url, Cms\Classes\Theme $theme ) : mixed
$item RainLab\Pages\Classes\MenuItem Specifies the menu item.
$url string Specifies the current page URL, normalized, in lower case The URL is specified relative to the website root, it includes the subdirectory name, if any.
$theme Cms\Classes\Theme Specifies the current theme.
리턴 mixed Returns an array. Returns null if the item cannot be resolved.

scopeFilterCategories() 공개 메소드

Allows filtering for specifc categories
public scopeFilterCategories ( Illuminate\Query\Builder $query, array $categories ) : Illuminate\Query\Builder
$query Illuminate\Query\Builder QueryBuilder
$categories array List of category ids
리턴 Illuminate\Query\Builder QueryBuilder

scopeIsPublished() 공개 메소드

public scopeIsPublished ( $query )

scopeListFrontEnd() 공개 메소드

Lists posts for the front end
public scopeListFrontEnd ( $query, array $options ) : self
$options array Display options
리턴 self

setUrl() 공개 메소드

Sets the "url" attribute with a URL to this object
public setUrl ( string $pageName, Cms\Classes\Controller $controller )
$pageName string
$controller Cms\Classes\Controller

프로퍼티 상세

$allowedSortingOptions 공개적으로 정적으로 프로퍼티

The attributes on which the post list can be ordered
public static array $allowedSortingOptions
리턴 array

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

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

$attachMany 공개적으로 프로퍼티

public $attachMany

$belongsTo 공개적으로 프로퍼티

* Relations
public $belongsTo

$belongsToMany 공개적으로 프로퍼티

public $belongsToMany

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

The attributes that should be mutated to dates.
protected array $dates
리턴 array

$implement 공개적으로 프로퍼티

public $implement

$preview 공개적으로 프로퍼티

public $preview

$rules 공개적으로 프로퍼티

* Validation
public $rules

$table 공개적으로 프로퍼티

public $table

$translatable 공개적으로 프로퍼티

Attributes that support translation, if available.
public $translatable