jadjoubran / laravel5-angular-material-starter

Get started with Laravel 5.3 and AngularJS (material)
https://laravel-angular.readme.io/
MIT License
1.66k stars 400 forks source link

fixes jadjoubran/laravel5-angular-material-starter#445 improve valida… #447

Closed aceart closed 7 years ago

aceart commented 7 years ago

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

jadjoubran commented 7 years ago

Hi @aceart Thanks for this! Shouldn't we use the approach we discussed in #445? which has the starts_with or else we might break it for users using standard laravel features outside of Angular

aceart commented 7 years ago

Hi @jadjoubran I can change it. But isn't the if-statement obsolete. The if-statement would be:

if ($validator->fails()) {
            if (Route::current()->getPrefix() === 'api' || starts_with(Route::current()->getPrefix(), 'api/')) {
                throw new ValidationException($validator);
            } else {
                throw new ValidationException($validator);
            }
        }

so the if-block does the same as the else-block. Is there any case I did not recognize?

jadjoubran commented 7 years ago

Sorry you're absolutely right Thanks again!