Webhook識別名重複チェック

This commit is contained in:
shibafu
2020-07-23 22:57:21 +09:00
parent 059c6d69cf
commit bbbea73a05
2 changed files with 14 additions and 2 deletions

View File

@@ -87,7 +87,16 @@ class SettingController extends Controller
public function storeWebhooks(Request $request)
{
$validated = $request->validate([
'name' => 'required|string|max:255'
'name' => [
'required',
'string',
'max:255',
Rule::unique('checkin_webhooks', 'name')->where(function ($query) {
return $query->where('user_id', Auth::id());
})
]
], [], [
'name' => '名前'
]);
if (Auth::user()->checkinWebhooks()->count() >= CheckinWebhook::PER_USER_LIMIT) {