• Laravel,  Laravel tips

    How to set up your local projects to contribute to Laravel (or any PHP library) : a practical guide

    Let’s imagine this scenario: You are working on a Laravel application, and you found a bug either in the framework itself or in one of the third party libraries you are using. You edit the code inside your project, or maybe you installed a fresh copy of Laravel and library that has the issue, and you edited the code there. You saved the changes, but when you went to your terminal to commit the changes, GIT just ignored what you did. You start wondering “What’s happening here?”.   The first solution that might pop up in your head could be to read the “How to contribute” of the framework or…

  • Laravel,  Laravel tips

    [Laravel tips] How to redirect users to a specific URL/route when the validation fails

    If you are using Form Request to validate your forms before you persist them in the database, when the validation fails, the user is usually redirected back to the same page that initiated the request. For instance if you are on /new-article page, after you submit the article you are creating, the user will be redirected back automatically to this very same URL if the data she entered failed to pass the validation. This is the desired behavior in majority of the cases. Lately, I was working on a form where I needed to redirect the user back to another route. I was working on an application where we have…