Vishal Petkar
Vishal Petkar

Reputation: 379

Laravel detect if error on blade page

I need to check if Laravel is redirected from failed validation. If so then I will use the old() function, otherwise I will show data from model.

I don't want to check for every input like old('name'). I just need a flag.

Upvotes: 0

Views: 2711

Answers (1)

Stan Barrows
Stan Barrows

Reputation: 973

In Blade for example:

@if ($errors->any())
    {{ old(ˋvalueˋ) }}
@endif

or

{{ old('value', $model->value) }}

Upvotes: 1

Related Questions