buid new app

This commit is contained in:
2026-03-09 01:00:49 +08:00
commit 97aed742af
126 changed files with 19341 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
<?php
namespace App\Http\Controllers;
use App\Models\CategoryRule;
use Illuminate\Http\Request;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
class CategoryRuleController extends Controller
{
use AuthorizesRequests;
public function store(Request $request)
{
$validated = $request->validate([
'keyword' => 'required|string|max:255',
'category_id' => 'required|exists:categories,id',
]);
CategoryRule::create([
...$validated,
'user_id' => auth()->id(),
]);
return redirect()->back();
}
public function destroy(CategoryRule $categoryRule)
{
if ($categoryRule->user_id !== auth()->id()) {
abort(403);
}
$categoryRule->delete();
return redirect()->back();
}
}