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 string $username
|
|
|
|
* @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
|
|
|
|
|
|
|
public function user()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(User::class);
|
|
|
|
}
|
2024-07-03 14:41:15 +03:00
|
|
|
}
|