I would like to change the status of my boolean in my msql5.7 when I click a button in my view.
I want that when I click on my button, the value of my boolean is switched( toggled between 0 and 1)
Here is my ajax code (my Dashboard.blade.php)
function reply_click(clicked_id){
$(function() {
$('#openButton').on('click', function(data) {
$.get("test.php", {clicked_id);
});
});
}
my DashboardController.php
class DashboardController extends Controller
{
public function index() {
return view('dashboard');
}
}
my migration file
public function up()
{
Schema::create('chaves',function (Blueprint $table){
$table -> increments('id');
$table -> string('nome');
$table -> boolean('alugado');
$table -> timestamps();
});
}
my route
Route::get("dashboard", "DashboardController@index")->name("dashboard")->middleware('auth');