I've a problem with Laravel 5.1 Redirect With Input. I can't seem to get old values from submitted input.
I've been research for any post in stack overflow and still stuck in this problem.
This is my request controller
public function create() {
$this->data["pageDescription"] = "Add new page.";
$this->data["pageSubtitle"] = $this->data["pageTitle"] . " Add New";
$this->data["formAction"] = adminRoute("page");
return view("admin.page.form")->with("data", $this->data)->withInput(Input::old());
}
and this is my submitted controller
public function store(Request $request) {
Input::flash();
$validator = Validator::make($request->all(), [
"title" => "required|max:100",
"url_title" => "required|max:100",
"meta_description" => "required|max:50",
"content_title" => "required|max:100",
"content_description_id" => "required",
"status" => "required|in:pending,published",
"add_more_content" => "required|in:true,false"
]);
if($validator->fails()) {
return redirect()->back()
->with("data", $this->data)
->withErrors($validator)
->withInput();
} else {
return redirect()->back()->withInput();
}
}
It's kinda weird because when I dump Session::all() before I redirect()->back() the _old_input is exists
But when I dump Session::all() on my function create() the _old_input is empty.
Even when I skip the validation, and use
redirect()->back()->withInput();
I still got the same problem, the old values input empty
This is my form view
Anybody know what I am doing it wrong?
Thank youu
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire