Aggiunta modifica categorie
This commit is contained in:
parent
8f55a70053
commit
f4a9f7123a
@ -28,6 +28,28 @@ class CategorieController extends Controller
|
||||
->delete();
|
||||
return redirect(route('categorie'));
|
||||
}
|
||||
public function updateCategorie(Request $request)
|
||||
{
|
||||
$id=$request['id'];
|
||||
$mov=DB::table('categories')
|
||||
->where('categories.id','=',$id)
|
||||
->get();
|
||||
return view('conti.categorie.update',
|
||||
[
|
||||
'categorie'=> $categorie,
|
||||
];
|
||||
}
|
||||
|
||||
public function updatePostCategorie(Request $request)
|
||||
{
|
||||
DB::table('categories')
|
||||
->where('id','=', $request['id'])
|
||||
->update([
|
||||
'cat_name' => $request['cat_name'],
|
||||
]);
|
||||
return redirect(route('categorie'));
|
||||
}
|
||||
|
||||
|
||||
public function apiList()
|
||||
{
|
||||
|
32
resources/views/conti/categorie/update.blade.php
Normal file
32
resources/views/conti/categorie/update.blade.php
Normal file
@ -0,0 +1,32 @@
|
||||
@extends('admin')
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<h1 class="page-header">Categorie</h1>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
Modifica categorie
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<form action="" method="POST">
|
||||
@foreach($categorie as $categoria)
|
||||
@csrf
|
||||
<div class="mb-3">
|
||||
<label for="categoria" class="form-label">Categoria</label>
|
||||
<input type="text" class="form-control" id="categoria" size="50" name="cat_name" value="{{ $categoria->cat_name }}">
|
||||
</div>
|
||||
<input type="hidden" name="id" value="{{ $_GET['id']; }}">
|
||||
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
|
||||
@endforeach
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
@ -39,6 +39,8 @@ Route::get('/', function () {
|
||||
Route::get('categorie', [CategorieController::class,'listCategorie'])->name('categorie');
|
||||
Route::post('categorie', [CategorieController::class,'insCategorie']);
|
||||
Route::get('catdelete', [CategorieController::class,'deleteCategorie']);
|
||||
Route::get('catmodify', [CategorieController::class,'updateCategorie']);
|
||||
Route::post('catmodify', [CategorieController::class,'updatePostCategorie']);
|
||||
|
||||
Route::get('tags', [TagController::class,'listTags'])->name('tags');
|
||||
Route::post('tags', [TagController::class,'insTags']);
|
||||
|
Loading…
Reference in New Issue
Block a user