'laravel MVC execution flow
I am new to laravel framework. I am trying to edit laravel webapplication.
Website is running in EC-2 instance of AWS. I am doing SCP with filezilla.
I found that /var/www/html/app has one route.php file. one of the route defined over there is :
#get checkout page
Route::get('/checkout', ['as' => 'checkout', 'uses' => 'CartController@getCheckout']);
When I hit example.com/checkout
It moves me to example.com/cart
getCheckout() of cart controller
// show checkout form
public function getCheckout()
{
if(getCartTotal())
{
return View::make('cart.checkout');
}else {
return Redirect::route('cart')->withCartErrorMessage('Please add some items to cart!');
}
}
My question is . when i change above route to product page or any thing else. it does not reflects and still moves me to wxample.com/cart.
even I removed route.php file and then hit example.com/checkout , it still moves me to example.com/cart
Why is it so ?
Edit :
I tested with php artisan routes command ,it lists all the routes from routes.php , and when i remove route.php file from /var/www/html/app folder, above command says Your application doesn't have any routes.
that means i am editing proper routes.php file. But why changed routes in /var/www/html/app routes.php file are not being reflected ?
Solution 1:[1]
if(getCartTotal())
{
return View::make('cart.checkout');
}else {
return Redirect::route('cart')->withCartErrorMessage('Please add some items to cart!');
}
In the above getCartTotal() function is returning false that is why it is redirecting to else and and then goes to cart
Solution 2:[2]
It could be the view cache, something similar happened to me before. In the folder storage/frameworks/views, i just cleared them all or by command
php artisan view:clear
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Ajay |
Solution 2 | Carlos |