24 lines
580 B
PHP
24 lines
580 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Admin;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use Illuminate\Http\Request;
|
|
|
|
use App\Models\Municipality;
|
|
|
|
class MunicipalityController extends Controller
|
|
{
|
|
public function index()
|
|
{
|
|
$municipalities = Municipality::all();
|
|
return view('admin.municipalities.index', compact('municipalities'));
|
|
}
|
|
|
|
public function toggle(Municipality $municipality)
|
|
{
|
|
$municipality->update(['is_active' => !$municipality->is_active]);
|
|
return back()->with('success', 'Statut de la commune mis à jour.');
|
|
}
|
|
}
|