N3OGeorgy
3 months ago
436
4
Laravel

Laravel 7 Add checks before FormRequest validation

Posted 3 months ago by N3OGeorgy

Hello,

I have a basic store method, with a FormRequest.

How i can do some checks before OrderStoreRequest makes the request validation, like :

public function store(OrderStoreRequest $request)
{
	// Make this redirect check first, before request validation:

        if( ! $request->session()->has('products')){
            return back()->with('error','No products added.');
        }

	// else continue with request validation
}

Thank you

Please sign in or create an account to participate in this conversation.