或許不足,歡迎補充呀! (•́へ•́╬)
第一種 用php 的 unset,嗯,直接銷燬有點暴力!
unset($input['testField'],$input['testField2'])
第二種 用request的 only 和 except 方法
$request->only('field','field2') // 獲取field和field2的數據集
$request->except('field') //獲取除field以外的數據集
第三種,在模型上指定 fillable 或 guarded屬性 (此方法僅對create操作有效)
protected $fillable=['testField']; //加入白名單
protected $guarded =['testField']; //加入黑名單