Aggiunto mappatura e prototipo filtro

This commit is contained in:
2025-08-06 19:28:01 +02:00
parent a1742e4e61
commit 652f9a7e76
12 changed files with 215 additions and 29 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Http\Controllers;
use App\Models\Categorie;
use App\Models\ImportRule;
use Illuminate\Http\Request;
@@ -13,6 +14,8 @@ class ImportRuleController extends Controller
public function index()
{
//
$rules = ImportRule::all();
return view('import_rules.index', compact('rules'));
}
/**
@@ -21,6 +24,11 @@ class ImportRuleController extends Controller
public function create()
{
//
// Return a view to create a new import rule
$categorie = Categorie::all();
return view('import_rules.create',compact('categorie'));
//'categories'=>$categorie);
}
/**
@@ -29,6 +37,15 @@ class ImportRuleController extends Controller
public function store(Request $request)
{
//
$request->validate([
'pattern' => 'required|string|max:255',
'category_id' => 'required|exists:categories,id',
'description' => 'nullable|string|max:255',
'is_active' => 'boolean',
'created_by' => 'nullable|string|max:255',
]);
ImportRule::create($request->all());
return redirect()->route('import_rules.index'); // Redirect to the index after storing the rule
}
/**