Laravel is loading the wrong view

I had two routes: “/something/step/1” and “/something/step/2”.

In my routes file they were defined like so:

Route::post(‘something/step/{step}’, ‘MyController@step’);
MyController@step was defined like so:
public function step($step) {
  if ($step === ‘1’) {
     return view(‘_form1’);
  }
  elseif ($step === ‘2’) {
    return view(‘_form2’);
  }
}
At some point, something stopped working and both route “/something/step/1” and “/something/step/2” returned the same view. In my vase _form1.blade.php
I found that running:
php artisan view:clear
and
php artisan route:clear
got things back on track.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s