안녕하세요 저는 laravel
5.2를 처음 사용하고 몇 가지 교훈을 겪었습니다.양식 모델 바인딩이 laravel에서 작동하지 않습니다. 5.2 laravelcollective를 사용합니다.
어떤 이유로 양식 모델 바인딩이 작동하지 않습니다.
{!! Form::text('title', "$post->title" ,['class'=> 'form-control']) !!}
을 그리고 내 데이터를 보여주고있다 :이 같은 해결 방법을 사용하고 있기 때문에
{!! Form::model($post, ['method'=>'PATCH', 'action'=> ['[email protected]', $post->id]]) !!}
나는
$post
데이터를 받았다.
컨트롤러 :
namespace App\Http\Controllers;
use App\Post;
use Illuminate\Http\Request;
use App\Http\Requests;
class PostController extends Controller{
public function update(Request $request, $id){
$post =Post::findOrfail($id);
$post->update($request->all());
return redirect('/posts');
}
}
create.blade.php보기 :
@section('content')
<h1>Create Post</h1>
{!! Form::open(['method'=>'POST', 'action'=>'[email protected]']) !!}
<!-- Title Form Input -->
<div class="form-group">
{!! Form::label('title', 'Title:') !!}
{!! Form::text('title', 'null', ['class'=> 'form-control']) !!}
</div>
<!-- Form Input -->
<div class="form-group">
{!! Form::submit('Create Post', ['class'=> 'btn-primary form-control']) !!}
</div>
{!! Form::close() !!}
@endsection
해야 우리는'laravelcollective/html' 작곡가 패키지에 대해 이야기하고 있는가? 컨트롤러 부분의 데이터를 어떻게 처리하는지 등 양식의 전체 섹션을 게시 할 수 있습니까? – phaberest
당신의 feedabck에 감사드립니다. 그렇습니다. lavavelcollective/html을 사용하고 있습니다. – Richard