*/
private function rules(bool $isCreate = false): array
{
- $rc = [
- 'presence1s' => 'required',
- 'presence2s' => 'required',
- 'presence3s' => 'required',
- 'presence1p' => 'required',
- 'presence2p' => 'required',
- 'presence3p' => 'required',
- 'imperfect1s' => 'required',
- 'imperfect2s' => 'required',
- 'imperfect3s' => 'required',
- 'imperfect1p' => 'required',
- 'imperfect2p' => 'required',
- 'imperfect3p' => 'required',
- 'participle' => 'required',
- 'separablepart' => '',
- 'transitive' => 'required',
- 'usage' => 'required',
- 'options' => ''
- ];
- if (! $isCreate){
- $rc ['word_id'] = 'required';
+ if ($isCreate){
+ $rc = [
+ 'imperfect1s' => 'required',
+ 'participle' => 'required',
+ 'separablepart' => '',
+ 'transitive' => 'required',
+ 'usage' => 'required',
+ 'options' => ''
+ ];
+
+ } else {
+ $rc = [
+ 'presence1s' => 'required',
+ 'presence2s' => 'required',
+ 'presence3s' => 'required',
+ 'presence1p' => 'required',
+ 'presence2p' => 'required',
+ 'presence3p' => 'required',
+ 'imperfect1s' => 'required',
+ 'imperfect2s' => 'required',
+ 'imperfect3s' => 'required',
+ 'imperfect1p' => 'required',
+ 'imperfect2p' => 'required',
+ 'imperfect3p' => 'required',
+ 'participle' => 'required',
+ 'separablepart' => '',
+ 'transitive' => 'required',
+ 'usage' => 'required',
+ 'options' => '',
+ 'word_id' => 'required'
+ ];
}
return $rc;
}
$rc = back()->withErrors($validator)->withInput();
} else {
$validated = $validator->validated();
+ $base = $fields['verb'];
+ $base = substr($base, 0, strlen($base) - 2);
+ $tail1 = str_ends_with($base, 's') ? 't' : 'st';
+ $tail2 = 'en';
+ $tail0 = 'e';
+ $validated ['presence1s'] = $base . $tail0;
+ $validated ['presence2s'] = $base . $tail1;
+ $validated ['presence3s'] = $base . $tail1;
+ $validated ['presence1p'] = $base . $tail2;
+ $validated ['presence2p'] = $base . $tail1;
+ $validated ['presence3p'] = $base . $tail2;
+ $base = $validated['imperfect1s'];
+ $base = substr($base, 0, strlen($base) - 1);
+ $validated ['imperfect2s'] = $base . $tail1;
+ $validated ['imperfect3s'] = $base . $tail1;
+ $validated ['imperfect1p'] = $base . $tail2;
+ $validated ['imperfect2p'] = $base . $tail1;
+ $validated ['imperfect3p'] = $base . $tail2;
$word = Word::create([
'word' => $fields['verb'],
- 'wordtype_scope' => 2001,
+ 'wordtype_scope' => 2002,
'verifiedby_id' => null,
'owner_id' => auth()->id(),
'language_scope' => 1201
'owner_id' => auth()->id()
]);
$validated['word_id'] = $word->id;
- Verb::create($validated);
+ $verb = Verb::create($validated);
+ $id = $verb->id;
+ $rc = redirect("/verb-edit/$id");
}
}
if ($rc == null) {
value="{{ $context->valueOf('separablepart') }}" width1="1" width2="2" />
<x-laraknife.forms.checkbox position="last" name="transitive" label="Transitive"
value="{{ $context->valueOf('transitive') }}" width1="1" width2="1" />
- <x-laraknife.forms.string position="first" name="presence1s" label="Präsens Ich"
- value="{{ $context->valueOf('presence1s') }}" width2="2" />
- <x-laraknife.forms.string position="middle" name="presence2s" label="Du"
- value="{{ $context->valueOf('presence2s') }}" width1="1" width2="2" />
- <x-laraknife.forms.string position="last" name="presence3s" label="Er/Sie/Es"
- value="{{ $context->valueOf('presence3s') }}" width1="1" width2="2" />
- <x-laraknife.forms.string position="first" name="presence1p" label="Präsens Wir"
- value="{{ $context->valueOf('presence1p') }}" width2="2" />
- <x-laraknife.forms.string position="middle" name="presence2p" label="Ihr"
- value="{{ $context->valueOf('presence2p') }}" width1="1" width2="2" />
- <x-laraknife.forms.string position="last" name="presence3p" label="Sie"
- value="{{ $context->valueOf('presence3p') }}" width1="1" width2="2" />
- <x-laraknife.forms.string position="first" name="imperfect1s" label="Imperfekt Ich"
+ <x-laraknife.forms.string position="alone" name="imperfect1s" label="Imperfekt Ich"
value="{{ $context->valueOf('imperfect1s') }}" width2="2" />
- <x-laraknife.forms.string position="middle" name="imperfect2s" label="Du"
- value="{{ $context->valueOf('imperfect2s') }}" width1="1" width2="2" />
- <x-laraknife.forms.string position="last" name="imperfect3s" label="Er/Sie/Es"
- value="{{ $context->valueOf('imperfect3s') }}" width1="1" width2="2" />
- <x-laraknife.forms.string position="first" name="imperfect1p" label="Imperfekt Wir"
- value="{{ $context->valueOf('imperfect1p') }}" width2="2" />
- <x-laraknife.forms.string position="middle" name="imperfect2p" label="Ihr"
- value="{{ $context->valueOf('imperfect2p') }}" width1="1" width2="2" />
- <x-laraknife.forms.string position="last" name="imperfect3p" label="Sie"
- value="{{ $context->valueOf('imperfect3p') }}" width1="1" width2="2" />
- <x-laraknife.forms.string position="alone" name="options" label="Options"
- value="{{ $context->valueOf('options') }}" width2="10" />
<x-laraknife.forms.text position="alone" name="usage" label="Usage"
value="{{ $context->valueOf('usage') }}" width2="10" rows="3" />
</x-laraknife.panels.create>