@extends('admin.layouts.master') @php function renderCategoryOptions($categories, $parentId = 0, $level = 0, $selected = []) { $html = ''; foreach ($categories as $category) { if ((int) $category->parent_id === (int) $parentId) { $prefix = str_repeat('--- ', $level); $isSelected = in_array($category->id, (array) $selected) ? 'selected' : ''; $html .= ""; $html .= renderCategoryOptions($categories, $category->id, $level + 1, $selected); } } return $html; } @endphp @section('style') @endsection @section('content')