MicroFrameWork/kernel/modules/post/models/Post.php

37 lines
939 B
PHP
Raw Normal View History

2024-07-03 14:41:15 +03:00
<?php
2024-09-06 16:53:20 +03:00
namespace kernel\modules\post\models;
2024-07-03 14:41:15 +03:00
use \Illuminate\Database\Eloquent\Model;
2024-09-26 14:47:13 +03:00
use kernel\modules\user\models\User;
2024-07-25 16:15:18 +03:00
/**
* @property int $id
2024-07-26 11:57:05 +03:00
* @property string $content
2024-09-26 14:47:13 +03:00
* @property string $title
* @property string $slug
2024-07-26 11:57:05 +03:00
* @property int $user_id
2024-07-25 16:15:18 +03:00
* @method static where(int[] $array)
* @method static find($id)
*/
2024-07-03 14:41:15 +03:00
class Post extends Model
{
2024-07-10 14:39:37 +03:00
protected $table = 'post';
2024-09-26 14:47:13 +03:00
protected $fillable = ['content', 'user_id', 'title', 'slug'];
2024-07-25 16:15:18 +03:00
public static function labels(): array
{
return [
2024-07-26 11:57:05 +03:00
'content' => 'Контент',
2024-09-26 14:47:13 +03:00
'title' => 'Заголовок',
'slug' => 'Slug',
2024-07-26 11:57:05 +03:00
'user_id' => 'Id пользователя',
2024-07-25 16:15:18 +03:00
'created_at' => 'Создан',
'updated_at' => 'Обновлен'
];
}
2024-09-26 14:47:13 +03:00
2024-10-07 11:31:16 +03:00
public function user(): \Illuminate\Database\Eloquent\Relations\BelongsTo
2024-09-26 14:47:13 +03:00
{
return $this->belongsTo(User::class);
}
2024-07-03 14:41:15 +03:00
}