mercredi 7 juin 2017

Undefined property: App\Http\Controllers\PageController::$validate in laravel

Hi have controller with action

public function postContact(Request $request)
{

    $this->validate($request, [
        'name'    => 'required',
        'email'   => 'required | email',
        'content' => 'required'
    ]);
    if(empty($this->validate->fails())){
        die('wrong');
         return redirect()->route('contact')->withInput();
   }
   return ('right');

}

When i don't fill all input this die on wrong, but when i fill all input this say a error:
ErrorException in PageController.php line 123: Undefined property: App\Http\Controllers\PageController::$validate How i fix it.
Thank for read my answer
Image



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire