]> gitweb.hamatoma.de Git - worxer.git/commitdiff
V0.0.8 Verb
authorWinfried Kappeler <winfried.kappeler@infeos.eu>
Mon, 1 Apr 2024 10:53:58 +0000 (12:53 +0200)
committerWinfried Kappeler <winfried.kappeler@infeos.eu>
Mon, 1 Apr 2024 10:53:58 +0000 (12:53 +0200)
- create of verb needs fewer attributes

CHANGELOG.md
app/Http/Controllers/VerbController.php
composer.lock
resources/views/verb/create.blade.php

index 8f86b882337e6b75981120e090d02d2d3f1cab7e..c06b2b51fd0f151bccc2d16ade67431d9df147c0 100644 (file)
@@ -1,3 +1,8 @@
+# V0.0.8 Verb
+
+## Changed
+- create of verb needs fewer attributes
+
 # V0.0.8 MenuitemWorxerSeeder
 
 ## Changed
index 7d9fc6a15ebb151e74215a4f6cd8b104fdf27c51..320265210bd831bf8f0232234438ccb6fc699e19 100644 (file)
@@ -138,27 +138,37 @@ class VerbController extends Controller
      */
     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;
     }
@@ -208,9 +218,27 @@ class VerbController extends Controller
                 $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
@@ -222,7 +250,9 @@ class VerbController extends Controller
                     '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) {
index d4f0e75479b428680f9503dea513c9a9eeb55446..9c584f7f387521e190b166e37528250bb91400dd 100644 (file)
         },
         {
             "name": "nesbot/carbon",
-            "version": "3.2.2",
+            "version": "3.2.3",
             "source": {
                 "type": "git",
                 "url": "https://github.com/briannesbitt/Carbon.git",
-                "reference": "2d69b6de67e2a3c0652d0c9dfcfda8b4563c4cee"
+                "reference": "4d599a6e2351d6b6bf21737accdfe1a4ce3fdbb1"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/2d69b6de67e2a3c0652d0c9dfcfda8b4563c4cee",
-                "reference": "2d69b6de67e2a3c0652d0c9dfcfda8b4563c4cee",
+                "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/4d599a6e2351d6b6bf21737accdfe1a4ce3fdbb1",
+                "reference": "4d599a6e2351d6b6bf21737accdfe1a4ce3fdbb1",
                 "shasum": ""
             },
             "require": {
                     "type": "tidelift"
                 }
             ],
-            "time": "2024-03-28T12:59:49+00:00"
+            "time": "2024-03-30T18:22:00+00:00"
         },
         {
             "name": "nette/schema",
index 19f4b017a081433ea273ef83fe8f92a68c137ca6..aa33c9220f9b4c7eee78ebf3ed86d371d43c24c1 100644 (file)
                 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>