mercredi 1 juin 2016

return withSuccess withErrors lost

i'm using a reqeust validation to validate my form post which works fine for a "simple" contact class but not for my posts class

Working:

ContractController GET:

public function showForm()
    {
        return view('contact');
    }

ContractController POST:

public function sendContactInfo(ContactRequest $request)
    {
blabla
return back()
            ->withSuccess("Thank you");
}

not working:

postcontroller GET:

public function changepost($postid)
    {

        $postdetail = posts::find($postid);
blabla
return view('changepost')->with("postdetail", $postdetail);
}

postcontroller POST:

public function changepostvalues(changepostreqeust $request)
    {
blabla
return back()->withSuccess("Thank you");
}

withSuccess and withError is only stored for the next request, correct? i've also tried to use Session:flash -> same result, success and error is not in the session. when i try Session::put all works fine. however i dont want to store the messeage permanently in the session and also want to understand why the infromations are lost...

i belief it has something to do with the "return view('changepost')->with("postdetail", $postdetail);" where i need to pass also the error and success messages....

thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire