@extends('layouts.admin')
@section('title', 'Creer un produit')
@section('page-title', 'Produits')
@section('content')
@if($errors->any())
@foreach($errors->all() as $error)
- {{ $error }}
@endforeach
@endif
@php
$categoriesForJs = $categories->map(function ($category) {
return [
'id' => $category->id,
'name' => $category->name,
'attributes' => $category->attributes->map(function ($attribute) {
return [
'id' => $attribute->id,
'name' => $attribute->name,
'type' => $attribute->type,
'required' => (bool) $attribute->required,
'options' => $attribute->options ?? [],
];
})->values(),
];
})->values();
@endphp
@endsection