3

I want to display the old data in blade after redirect. So if the old data is empty or doesn't exists it should display my passed task data multidimensional array.

Laravel:

redirect()->withInput();

Blade:

name ="task[{{$dayKey}}][]"
value="{{old('task.'.$dayKey.'.'.$key) or $task}}"

Separately {{old('task.'.$dayKey.'.'.$key) and $task works fine but if i used or the output is every time 1.

1 Answer 1

1

You can set default value with comma separated second argument.

value="{{old('task.'.$dayKey.'.'.$key, $task)}}"

This will check for old input value, if there is no old input value then will set the default one.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.