일반적인 질문이 있습니다.Laravel의 데이터베이스 컬럼 업데이트/게시
나는 데이터베이스에서 결과를 반환하는 검색 양식을 larvel에 가지고 있습니다. 이들의
나는 가격 == 0경우 내가 '가격을 입력하고 아무튼, 즉 내 이전 검색 결과없이 검색 페이지로 돌아 제출할 때 내 문제가 무엇인지 가격을 입력하는 입력 필드가 t는 동일한 결과 페이지 새로 업데이트 등 필드 뷰
형태를 새로
{{ Form::open(['action' => 'price_input'])->with($gyms) }}
{{ Form::text('enter_price', null, ['class' => 'form-control', 'size' => '50', 'id' => 'enter_price', 'autocomplete' => 'on', 'runat' => 'server', 'required' => 'required', 'placeholder' => 'enter price!', 'style' => 'margin-bottom: 0px!important;']) }}
{{ Form::submit('Search', ['class' => 'btn btn- primary', 'style' => 'margin-left: 10px;']) }}
{{ Form::close() }}
행
Route::post('/', [ //not used yet
'as' => 'price_input',
'uses' => '[email protected]'
]);
,174,
모델
public function priceUpdate($gyms)
{
if (Input::has('enter_price'))
{
$price = Input::get('enter_price');
Gym::updatePrice($price);
return Redirect::back()->withInput();
}
Session::get('gyms');
return Redirect::to('pages.home') ->with('gyms', $gym);
}
이 잘 작동으로 모델을 귀찮게하지.
아이디어가 있으십니까? 답변에 대한
덕분에,
나는이
public function priceUpdate($gyms)
{
if (Input::has('enter_price'))
{
$price = Input::get('enter_price');
Gym::updatePrice($price);
$gyms = Session::get('gyms');
return Redirect::to('pages.home') ->with('gyms', $gyms);
}
$gyms = Session::get('gyms');
return Redirect::to('pages.home') ->with('gyms', $gyms);
}
내 컨트롤러를 변경하지만 난 그것을 실행할 때 나는 이 PagesController에 대한 인수 1 누락 :: priceUpdate() 을 $ 체육관에 도착 메서드에 전달됩니다.
내가 떠나가는 $ gyms를 꺼내지 만 여전히 세션으로 전달되는지 여부는 확실하지 않습니다. 미안하지만 초보자입니다.
는 orignally 내가 돌아return View::make('pages.home')->with($data);
그와
return View::make('pages.home')->with($data);
의 차이점은 무엇입니까를 운영하는 검색 상자를했다 나는 그것을 더 검색과 검색 페이지로 돌아갑니다 위의 라인을 수행 할 때 옵션을 업데이트하기 전에 양식, 아이디어?