Mein form.blade.php
ist etw wieLaravel Formular Modell
<div class="form-group">
{!! Form::label('title', 'title :', ['class' => 'awesome']) !!}
{!! Form::text('product[title]', null, ['class' => 'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label('description', 'description : ', ['class' => 'awesome']) !!}
{!! Form::text('product[description]', null, ['class' => 'form-control']) !!}
<div id="phone" class="form-group">
{!! Form::label('reference_id1', 'reference_id1 : ', ['class' => 'awesome']) !!}
{!! Form::text('product[reference_id1]', null, ['class' => 'form- control']) !!}
</div>
<div class="form-group">
{!! Form::label('category_id', 'category_id : ', ['class' => 'awesome']) !!}
{!! Form::select('category[]', $categories,null, ['class' => 'form- control', 'multiple']) !!}
</div>
<div class="form-group">
{!! Form::label('color', 'color : ', ['class' => 'awesome']) !!}
{!! Form::text('feature[0][color]', null, ['class' => 'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label('height', 'height : ', ['class' => 'awesome']) !!}
{!! Form::text('feature[0][height]', null, ['class' => 'form-control']) !!}
</div> `
und meine Edit.blade.php
wie
{!! Form::model($product,['method' => 'PATCH', 'action' => ['[email protected]',$product->id]]) !!}
@include('products.form', ['submitBtn' => 'submit'])
{!! Form::close() !!}
Und das ist mein [email protected]
public function edit($id)
{
$product = Product::with('feature')->findOrFail($id);
$categories = Category::pluck('title','id');
return view('products.edit')->withProduct($product)->withCategories($categories);
}
Dies ist, während ich ein Produkt bearbeiten möchte, sind die Eingabeanforderungen leer gesetzt !! zum Beispiel, wenn ich gehe die title
und andere Eingänge sind leer :( Anregungen ?!
ich benutze Strecke :: ressource ('product', 'ProductController', [ 'name' => ['index' => 'products_path', 'show' => 'produktpfad', 'create' => 'create_product_path', 'edit' => 'edit_path'], ]); in meiner web.php (routes file) – Omid
Sie können versuchen, nur '$ id' mit dem leeren Wert' "" oder 'null' zu initialisieren und alle Aktionen auszuführen, wenn' $ id' nicht 'null' oder leer ist. –
tatsächlich ist meine '$ ID' nicht leer und vielen Dank für die Überprüfung der ID – Omid