E
E
Eugene2017-08-31 01:09:06
Laravel
Eugene, 2017-08-31 01:09:06

How to understand what could be the problem? if! doesn't work?

Hey! They asked me to help solve problems, and for three days now I have been in a stupor. Laravel project. After registration, the user must leave three reviews about different restaurants. For this, three routes and three companies were made (I don’t know why).

Route::get('/post-review-one', '[email protected]');
Route::get('/post-review-two', '[email protected]');
Route::get('/post-review-three', '[email protected]');

Form validation routes:
Route::post('/back-end/api/add-review/signup-finish', '[email protected]_validate');
    Route::post('/back-end/api/add-review/signup-finish/two', '[email protected]_validate');
    Route::post('/back-end/api/add-review/signup-finish/three', '[email protected]_validate');

The point is. The problem is in the mobile version. Each form validation and feedback function contains the following validation:
// Код проверки первого роута
return redirect('/post-review-two');

// Это из проверки второго
        $first_review_rid = Request::get('review_rid_1');

        if($param['restaurant_id'] != $first_review_rid) {
            $addReview = $reviewsModel->addReview($param);

            // Define current step and make redirect to the next step
            return redirect('/post-review-three');
        } else {
            return redirect('/already-posted/2');
        }

//а то из трутьего
$first_review_rid = Request::get('review_rid_1');
        $second_review_rid = Request::get('review_rid_2');

        if($param['restaurant_id'] != $first_review_rid && $param['restaurant_id'] != $second_review_rid) {
            $addReview = $reviewsModel->addReview($param);

            // Define current step and make redirect to the next step
            return redirect('/upload-image');
        } else {
            return redirect('/already-posted/3');
        }

That is, it checks whether the user wrote a review for a place in this id. If so, redirects it to the error page. Again, I don’t know why such crutches are used and the person is not returned to this form with an error.
What's happening. The user leaves the first review, he is redirected to the second page. Here the user adds a review to a completely different place, but receives an error that he has already added a review (although he did not), and at the same time the review is added to the database. That is, it turns out the check and passed and not? And it hangs on it. Posts reviews on different places, gets errors about what has already been added, but reviews are fasting.
Can you suggest what the problem is? Is it possible that the browser is caching redirects? Although on the second page a completely new user gets an error. In general, in difficulty, but I want to help. Yes, and very interesting.
The site has a separate washing version, not adaptive. The code is the same here and there. However, this is not the case for the desktop version. I also tested from a computer and phone to android and never managed to reproduce. However, about every fifth user does this. Most problematic iPhone users.
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question