|
|
@@ -14,14 +14,14 @@ class MaterialController extends Controller
|
|
|
use AsyncResponse;
|
|
|
public function index(Request $request,MaterialFilters $filter)
|
|
|
{
|
|
|
- $this->gate('耗材');
|
|
|
+ $this->gate('耗材类型');
|
|
|
$materials = Material::query()->orderByDesc('id')->filter($filter)->paginate($request['paginate'] ?? 50);
|
|
|
return view('maintenance/material/index',compact('materials'));
|
|
|
}
|
|
|
|
|
|
public function storeApi(Request $request):array
|
|
|
{
|
|
|
- $this->gate('耗材-编辑');
|
|
|
+ $this->gate('耗材类型-编辑');
|
|
|
$material = Material::query()->where('code',$request['code'])->first();
|
|
|
if($material)return ['success' => false,'message'=>'code对应的耗材已存在'];
|
|
|
try {
|
|
|
@@ -34,7 +34,7 @@ class MaterialController extends Controller
|
|
|
|
|
|
public function updateApi(Request $request):array
|
|
|
{
|
|
|
- $this->gate('耗材-编辑');
|
|
|
+ $this->gate('耗材类型-编辑');
|
|
|
$material = Material::query()->find($request['id']);
|
|
|
try {
|
|
|
$material->update($request->all(['code', 'name']));
|
|
|
@@ -46,7 +46,7 @@ class MaterialController extends Controller
|
|
|
|
|
|
public function destroyApi($id):array
|
|
|
{
|
|
|
- $this->gate('耗材-删除');
|
|
|
+ $this->gate('耗材类型-删除');
|
|
|
/** @var Material $material */
|
|
|
$material = Material::query()->find($id);
|
|
|
try {
|