all I want is to define the form model on template and then put a yield as the content of form data. But it cannot assign the model data correctly into each field that has been defined. This is my code:
template.detail.blade.php
@extends('admin.template.lte.layout.basic')
@section('content-page')
{!! Form::model($model, ['url' => $formAction]) !!}
@yield('data-form')
{!! Form::close() !!}
@if ($errors->any())
@stop
partial.edit.blade.php
@extends('template.detail')
@section('data-form')
<div class="form-group">
{!! Form::label('Dal_Name', 'Alternative Name', ['class' => 'required']) !!}
{!! Form::text('Dal_Name', null, ['required', 'class' => 'form-control', 'placeholder' => 'Enter Alternative Name']) !!}
</div>
<div class="form-group">
{!! Form::label('Dal_DssID', 'DSS Period', ['class' => 'required']) !!}
{!! Form::select('Dal_DssID', $dssOptions, null, ['class' => 'form-control']) !!}
</div>
<div class="checkbox">
<label for="Dal_Active">
{!! Form::hidden('Dal_Active', 'N') !!}
{!! Form::checkbox('Dal_Active', 'Y') !!}
Active
</label>
</div>
@stop
My Controller part:
/**
* Show the form for editing the specified resource.
*
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
$this->data['model'] = DssAlternative::find($id);
$this->data['formAction'] = \Request::current();
$this->data['dssOptions'] = Dss::lists('Dss_Name', 'Dss_ID');
return view('partial.edit', $this->data);
}
But the model data does not propagate to form correctly. Sorry for my bad english.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire