38 lines
920 B
PHP
38 lines
920 B
PHP
<?php
|
|
|
|
namespace kernel\modules\post\models;
|
|
use \Illuminate\Database\Eloquent\Model;
|
|
use kernel\modules\user\models\User;
|
|
|
|
/**
|
|
* @property int $id
|
|
* @property string $content
|
|
* @property string $title
|
|
* @property string $slug
|
|
// * @property string $username
|
|
* @property int $user_id
|
|
* @method static where(int[] $array)
|
|
* @method static find($id)
|
|
*/
|
|
class Post extends Model
|
|
{
|
|
protected $table = 'post';
|
|
protected $fillable = ['content', 'user_id', 'title', 'slug'];
|
|
|
|
public static function labels(): array
|
|
{
|
|
return [
|
|
'content' => 'Контент',
|
|
'title' => 'Заголовок',
|
|
'slug' => 'Slug',
|
|
'user_id' => 'Id пользователя',
|
|
'created_at' => 'Создан',
|
|
'updated_at' => 'Обновлен'
|
|
];
|
|
}
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
} |