So, I am not sure why I am getting the following error when loading my view :
Undefined variable: document(View: C:\xampp\htdocs\learn-laravel\resources\views\edit-record.blade.php)
My controller action is looking like this :
public function edit($id)
{
$document= Document::where('id',$id)->get();
//dd($document);
return view('edit-record')->with('$document',$document);
}
View:
@extends('layouts.app')
@section('content')
<div class="input-group inptit form-group">
{{Form::text('title',$document->name,['class'=>'form-control','placeholder'=>'Enter document title...'])}}
</div>
@endsection
Can anyone explain why am I getting this error? I am clearly passing the record to the view? When I debug with dd()
I can see the record.