Trying to make a redirect with the value of specific input data once the validation fails.
public function authorize() {
$data = $this->all();
return redirect()->back()->with('cat_id',$data['category_id']);
}
public function rules()
{
if($this->getMethod() == 'POST') {
return [
'category_id' => 'required',
];
}
}
What I want is to redirect the request back with category_id
input value. Looked at documentation of laravel but couldn't find the way.
Tried : $this->input('category_id')
, request()->category_id
, $this->route()->parameter('category_id')
, $this->get("category_id")
None of them above used to work unfortunately.Any suggestion would be highly appreciated.