Add function insert name and translation into DB
This commit is contained in:
@@ -35,4 +35,22 @@ class WordsController extends Controller
|
||||
|
||||
return redirect('/words');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an existing Word in the database.
|
||||
*/
|
||||
public function update(Request $request): RedirectResponse
|
||||
{
|
||||
|
||||
return redirect('/words');
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an existing Word in the database.
|
||||
*/
|
||||
public function delete($id): RedirectResponse
|
||||
{
|
||||
word::destroy($id);
|
||||
return redirect('/words');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
<tr>
|
||||
<td>{{ $item->{$fields[0]} }}</td>
|
||||
<td>{{ $item->{$fields[1]} }}</td>
|
||||
<td> <a href=""><button class="btn btn-primary">Edit</button> </a> </td>
|
||||
<td> <a href="delete_record/{{ $item->id }}"><button class="btn btn-danger">Delete</button> </a> </td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
|
||||
@@ -33,11 +33,6 @@
|
||||
@include('words.partials.insert-word-form')
|
||||
</div>
|
||||
</div>
|
||||
{{--<div class="p-4 sm:p-8 bg-white dark:bg-gray-800 shadow sm:rounded-lg">--}}
|
||||
{{-- <div class="max-w-xl">--}}
|
||||
{{-- @include('words.partials.modify-word-form')--}}
|
||||
{{-- </div>--}}
|
||||
{{--</div>--}}
|
||||
</div>
|
||||
</div>
|
||||
<x-table :items="$words" :fields="array('name','translation')" />
|
||||
|
||||
@@ -14,19 +14,17 @@
|
||||
|
||||
<div>
|
||||
<x-input-label for="name" :value="__('Italian Word')" />
|
||||
<x-text-input id="name" name="name" type="text" class="mt-1 block w-full" placeholder="Italian Word"/>
|
||||
<x-text-input id="name" name="name" type="text" class="mt-1 block w-full" placeholder="Italian Word" required autofocus autocomplete="name"/>
|
||||
<x-input-error :messages="$errors->get('name')" class="mt-2" />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<x-input-label for="translation" :value="__('Dialect Word')" />
|
||||
<x-text-input id="translation" name="translation" type="text" class="mt-1 block w-full" placeholder="Dialectic Word"/>
|
||||
<x-text-input id="translation" name="translation" type="text" class="mt-1 block w-full" placeholder="Dialectic Word" required autofocus autocomplete="translation" />
|
||||
<x-input-error :messages="$errors->get('translation')" class="mt-2" />
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-4">
|
||||
<button type="submit" class="btn btn-primary me-2">Submit</button>
|
||||
|
||||
<x-primary-button>{{ __('Submit') }}</x-primary-button>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
@@ -56,7 +56,8 @@ Route::prefix('words')->group(function () {
|
||||
Route::post('/', [WordsController::class, 'store'])->name('words.insert');
|
||||
});
|
||||
|
||||
|
||||
Route::get('delete_record/{id}', [WordsController::class, 'delete']);
|
||||
//Route::get('delete_record/{id}', [WordsController::class, 'update']);
|
||||
|
||||
require __DIR__ . '/auth.php';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user