rest controller
This commit is contained in:
@ -2,10 +2,13 @@
|
||||
|
||||
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)
|
||||
@ -14,15 +17,22 @@ use \Illuminate\Database\Eloquent\Model;
|
||||
class Post extends Model
|
||||
{
|
||||
protected $table = 'post';
|
||||
protected $fillable = ['content', 'user_id'];
|
||||
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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user