You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
999 B
PHP

<?php
namespace App\Http\Controllers;
use App\Models\CustomerLevel;
use Illuminate\Http\Request;
class CustomerLevelController extends Controller
{
public function index()
{
$query = CustomerLevel::query();
return inertia('CustomerLevel/Index', [
'query' => $query->paginate(),
]);
}
public function update(Request $request, CustomerLevel $customerLevel)
{
$request->validate([
'name' => 'required|string',
'description' => 'nullable|string',
'min_amount' => 'required|numeric|min:0',
'max_amount' => 'required|numeric|min:0',
]);
$customerLevel->update([
'name' => $request->name,
'description' => $request->description,
'min_amount' => $request->min_amount,
'max_amount' => $request->max_amount,
]);
session()->flash('message', ['type' => 'success', 'message' => 'Item has beed updated']);
}
}