recently started learning laravel following laravel scratch cast(https://laracasts.com/series/laravel-5-from-scratch).
right i'm trying add additional functionality registration form(starting error feedback) , ran problem.
is there (native) way check wether form has been submitted or not? tried use:
{{ request::method() }}
but after pressing register on default scaffold generated running command php artisan make:auth
returns get while action of form post , triggers route post request type.
the reason of want add css class element based on following requirements.
if form submitted if $errors->has('name') //is there error name(example) add 'has-error' class else add 'has-success' class endif endif
does know solution it?
i think want achieve this:
if( old('name') ){ // name has been submitted if( $errors->first('name') ){ // there @ least error on // add error class }else{ // has been submitted without errors // add valid class } }
that in input field this:
<input name="name" class="validate{{ old('name') ? ( $errors->first('name') ? ' invalid' : ' valid') : '' }}" type="text" value="{{ old('name') }}">