Featured

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.