authorizeIe('ie.platforms.view'); $businessId = $this->businessId(); if ($request->ajax()) { return DataTables::of(ProductPlatform::forBusiness($businessId)) ->addColumn('action', fn ($row) => '') ->rawColumns(['action']) ->make(true); } return view('industrialengineering::product_platforms.index'); } public function create() { $this->authorizeIe('ie.platforms.create'); return view('industrialengineering::product_platforms.create'); } public function store(Request $request) { $this->authorizeIe('ie.platforms.create'); $data = $request->validate([ 'platform_code' => 'required|string|max:100', 'name' => 'required|string|max:255', 'description' => 'nullable|string', 'industry_segment' => 'nullable|string|max:100', 'template_code' => 'nullable|string|max:100', 'template_name' => 'nullable|string|max:255', ]); $data['business_id'] = $this->businessId(); $platform = ProductPlatform::create($data); if ($request->filled('template_code')) { LineTemplate::create([ 'business_id' => $this->businessId(), 'product_platform_id' => $platform->id, 'template_code' => $request->input('template_code'), 'name' => $request->input('template_name', $platform->name), ]); } return redirect()->action([self::class, 'show'], $platform->id) ->with('status', ['success' => true, 'msg' => __('industrialengineering::lang.saved')]); } public function show($id) { $this->authorizeIe('ie.platforms.view'); $platform = ProductPlatform::forBusiness($this->businessId()) ->with('lineTemplates.revisions') ->findOrFail($id); return view('industrialengineering::product_platforms.show', compact('platform')); } }