我试图从我的add.blade中的表单中获取我的专家的生物,但检索到的唯一数据是名称...我尝试清空textarea中的值并给出值=“{{old('bio ')“}}仍然不起作用。下面是最新的代码..
add.blade.php
<form method="post" action="{{ route('creato') }}">
{!! csrf_field() !!}
<div class="form-group ">
<b><label class="control-label" for="name">Name</label></b>
<input type="text" class="form-control" id="name" name="name" value="{{ old('name') }}">
</div>
<div>
------------
</div>
<div class="form-group">
<b><label class="control-label" for="bio">A little about the expert</label></b>
</div>
<div class="form-group">
{{-- HERE IS THE PROBLEM THIS TEXT AREA HERE DOES NOT SEND VALUE --}}
<textarea type="text" class="kokoa" id="bio" name="bio"> {{ old('bio') }} </textarea>
</div>
<button type="submit" class="btn btn-primary pull-right">Submit</button>
<hr>
<a href="{{ route('home') }}">Back</a>
</form>
routes.php文件
Route::group(['prefix' => 'experts'], function ()
{
Route::get('/add',['as'=>'add','uses'=>'ExpertsController@add']);
Route::post('/wee',['as'=>'creato','uses'=>'ExpertsController@create']);});
ExpertsController.php
public function add(){
$title = 'A new expert is born';
return view('add',compact('title'));
}
public function create(CreateExpertsRequest $request) {
$experts = Experts::create([
'name'=>$request->get('name'),
'bio'=>$request->get('bio')
]);
return redirect()->route('home');
}
CreatesExpertsRequest
public function authorize()
{
return true;
}
public function rules()
{
return [
'name' => 'required',
'bio' => 'required',
];
}
答案 0 :(得分:0)
我没有把它放在我的模型中......
expert.php(上一页)
class Experts extends Model
{
protected $table = 'experts';
protected $fillable = [
'name',
];
}
现在
class Experts extends Model
{
protected $table = 'experts';
protected $fillable = [
'name','bio'
];
}