PHP Class app\models\News

Inheritance: extends App\Model
Show file Open project: qloog/laravel5-backend Class Usage Examples

Protected Properties

Property Type Description
$fillable array The attributes that are mass assignable.
$hidden array The attributes excluded from the model's JSON form.
$table string The table associated with the model.

Public Methods

Method Description
category ( ) Get the category that owns the news.
getPageImageAttribute ( $value )
syncTags ( array $tags ) Sync tag relation adding new tags as needed
tags ( ) : BelongsToMany The many-to-many relationship between news and tags.
user ( ) : BelongsToMany The one-to-one relationship between news and users.

Method Details

category() public method

The one-to-one relationship between news and category.
public category ( )

getPageImageAttribute() public method

public getPageImageAttribute ( $value )

syncTags() public method

Sync tag relation adding new tags as needed
public syncTags ( array $tags )
$tags array

tags() public method

The many-to-many relationship between news and tags.
public tags ( ) : BelongsToMany
return BelongsToMany

user() public method

The one-to-one relationship between news and users.
public user ( ) : BelongsToMany
return BelongsToMany

Property Details

$fillable protected property

The attributes that are mass assignable.
protected array $fillable
return array

$hidden protected property

The attributes excluded from the model's JSON form.
protected array $hidden
return array

$table protected property

The table associated with the model.
protected string $table
return string