部落格連結:https://www.cnblogs.com/Wenxiaopeng/p/1115...
$name = isset(request()->all()['name']) ? request()->all()['name'] : '';
$id = isset(request()->route()->parameters['car']) ? request()->route()->parameters['car'] : '';
$form->select('aid', 'aid')->options('/admin/xx')
->creationRules(['required', "unique:表名,當前欄位名,NULL,id,其他欄位,{ 值 }"], ['unique' => '資料已存在'])
->updateRules(['required', "unique:cars,aid,{$id},id,name,{$name}"], ['unique' => '資料已存在']);
本作品採用《CC 協議》,轉載必須註明作者和本文連結