1

I have a multi-step form. There are steps like : step 1 , step 2 ... step 5.

How can i check people should follow this steps ? Is there a way to check if he comes from previous-true url(step) or any other way ?

Thanks !

2
  • Display different div only if the previous one is filled. That's a great way Commented Aug 10, 2015 at 13:11
  • 1
    Also validate all previous and current step data on each step submission. Commented Aug 10, 2015 at 13:47

2 Answers 2

9

URL::previous() will return the referrer url. If you want to prevent that they use cross-site request forgeries use laravel's csrf-protection. http://laravel.com/docs/5.1/routing#csrf-protection

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

3 Comments

so ,for example is it possible to prevent someone to go to step 3 directly with step 3's url ?
yes , i tried its possible with a if control like : if( URL::previous() == ) go to url
you can also use Sessions to make sure the user can only visit the next page.
4

If you want to use the previous URL in blade file, please use as follows:

{{ url()->previous() }}  

For current path use as follows accordingly if the current path is:
Example: http://localhost:8000/brand/campaign/create/about

request()->Fullurl(); 
// http://localhost:8000/brand/campaign/create/about 

request()->URL();      
// http://localhost:8000/brand/campaign/create/about 

request()->root();     
// http://localhost:8000 

request()->path();     
// brand/campaign/create/about 

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.