Skip to content
Mitsuru Mutaguchi edited this page Feb 7, 2025 · 3 revisions

SamplePost.php(記事 モデル)

<?php

namespace App\ModelsOption\User\Samples;

use Illuminate\Database\Eloquent\Model;
use App\UserableNohistory;

/**
 * 記事 モデル
 *
 * @author 永原 篤 <nagahara@opensource-workshop.jp>
 * @copyright OpenSource-WorkShop Co.,Ltd. All Rights Reserved
 * @category サンプル・プラグイン
 * @package Controller
 */
class SamplePost extends Model
{
    // 保存時のユーザー関連データの保持
    use UserableNohistory;

    // 更新する項目の定義
    protected $fillable = ['sample_id', 'title', 'content'];
}
  • UserableNohistory をuse することで、Connect-CMS のテーブルサフィックスが自動で登録されます。
  • $fillable はLaravel の複数代入です。
Clone this wiki locally