Nasr1
2 years ago

use model binding to get old values in the form

Posted 2 years ago by Nasr1

hello , am building an update form , i need in the edit page the old values or the values that need to be edited appear in ther fields , now this is my edit.blade.php:-

{!! Form::model(array($bus,['route'=>['buses.update',$bus->Id]])) !!}

Edit Bus

//this is one of the fields

Capacity
            {!! Form::text('capacity', null, [
        'class'                         => 'form-control',
        'placeholder'                   => 'Capacity',
        'required',
        'id'                            => 'capacity',
        'data-parsley-required-message' => 'Capacity is required',
        'data-parsley-trigger'          => 'change focusout',
        'data-parsley-type'             => 'digits'
    ]) !!}
        </div>

//BUS edit action method :-

public function edit($id)
{
    $bus=\App\Models\Bus::find($id);

    return view('buses.edit')->withBus($bus);
}

NOW WHAT TO DO TO MAKE THE OLD VALUES APPEAR PLZ HELP ME

Please sign in or create an account to participate in this conversation.