Webhook識別名重複チェック
This commit is contained in:
parent
059c6d69cf
commit
bbbea73a05
@ -87,7 +87,16 @@ class SettingController extends Controller
|
|||||||
public function storeWebhooks(Request $request)
|
public function storeWebhooks(Request $request)
|
||||||
{
|
{
|
||||||
$validated = $request->validate([
|
$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) {
|
if (Auth::user()->checkinWebhooks()->count() >= CheckinWebhook::PER_USER_LIMIT) {
|
||||||
|
@ -20,8 +20,11 @@
|
|||||||
{{ csrf_field() }}
|
{{ csrf_field() }}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="name">名前 (メモ)</label>
|
<label for="name">名前 (メモ)</label>
|
||||||
<input id="name" class="form-control" name="name" type="text" required>
|
<input id="name" class="form-control {{ $errors->has('name') ? ' is-invalid' : '' }}" name="name" type="text" required>
|
||||||
<small class="form-text text-muted">後で分かるように名前を付けておいてください。</small>
|
<small class="form-text text-muted">後で分かるように名前を付けておいてください。</small>
|
||||||
|
@if ($errors->has('name'))
|
||||||
|
<div class="invalid-feedback">{{ $errors->first('name') }}</div>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
<button class="btn btn-primary" type="submit">新規作成</button>
|
<button class="btn btn-primary" type="submit">新規作成</button>
|
||||||
</form>
|
</form>
|
||||||
|
Loading…
Reference in New Issue
Block a user