Modifica delle route per i tags
This commit is contained in:
parent
51b0d71204
commit
6f16876a69
@ -42,4 +42,9 @@ class TagController extends Controller
|
|||||||
$tags=tag::getList();
|
$tags=tag::getList();
|
||||||
return json_encode($tags);
|
return json_encode($tags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function deleteTag($id){
|
||||||
|
tag::delete($id);
|
||||||
|
return redirect(route('tags'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,4 +33,11 @@ class tag extends Model
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function delete($id)
|
||||||
|
{
|
||||||
|
DB::table('tags')
|
||||||
|
->where('id','=',$id)
|
||||||
|
->delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
2
public/js/app/tag.js
vendored
2
public/js/app/tag.js
vendored
@ -3,7 +3,7 @@ $(document).ready(function() {
|
|||||||
responsive: true
|
responsive: true
|
||||||
});
|
});
|
||||||
$(document).on('click', '.open_modal', function() {
|
$(document).on('click', '.open_modal', function() {
|
||||||
var url = "tagmodify";
|
var url = "tags/modify";
|
||||||
var riga_id = $(this).val();
|
var riga_id = $(this).val();
|
||||||
$.getJSON(url + '/' + riga_id, function(data) {
|
$.getJSON(url + '/' + riga_id, function(data) {
|
||||||
//success data
|
//success data
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
$tag->tag_name; }}</a></td>
|
$tag->tag_name; }}</a></td>
|
||||||
<td><button class="btn btn-warning btn-detail open_modal"
|
<td><button class="btn btn-warning btn-detail open_modal"
|
||||||
value="{{ $tag->id; }}">Edit</button> <a
|
value="{{ $tag->id; }}">Edit</button> <a
|
||||||
class="btn btn-danger" href="/admin/tagdelete?id={{ $tag->id; }}"><i
|
class="btn btn-danger" href="/admin/tags/delete/{{ $tag->id; }}"><i
|
||||||
class="fa fa-trash-o fa-fw"></i></a> </td>
|
class="fa fa-trash-o fa-fw"></i></a> </td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
@ -34,7 +34,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
|
<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
|
||||||
aria-labelledby="myModalLabel" aria-hidden="true">
|
aria-labelledby="myModalLabel" aria-hidden="true">
|
||||||
<form action="tagmodify" method="POST">
|
<form action="/admin/tags/modify" method="POST">
|
||||||
<div class="modal-dialog" role="document">
|
<div class="modal-dialog" role="document">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
|
@ -60,8 +60,9 @@ Route::get('/', [MovimentiController::class,'dashboard']);
|
|||||||
// TAGS
|
// TAGS
|
||||||
Route::get('tags', [TagController::class,'listTags'])->name('tags');
|
Route::get('tags', [TagController::class,'listTags'])->name('tags');
|
||||||
Route::post('tags', [TagController::class,'insTags']);
|
Route::post('tags', [TagController::class,'insTags']);
|
||||||
Route::get('tagmodify/{id}', [TagController::class,'updateTag']);
|
Route::get('tags/modify/{id}', [TagController::class,'updateTag']);
|
||||||
Route::post('tagmodify', [TagController::class,'updatePostTag']);
|
Route::post('tags/modify', [TagController::class,'updatePostTag']);
|
||||||
|
Route::get('tags/delete/{id}',[TagController::class,'deleteTag']);
|
||||||
|
|
||||||
// CONSUMI
|
// CONSUMI
|
||||||
Route::get('consumi/gas', [ContatoreGasController::class,'listLettureGas'])->name('gas');
|
Route::get('consumi/gas', [ContatoreGasController::class,'listLettureGas'])->name('gas');
|
||||||
|
Loading…
Reference in New Issue
Block a user