title: laravel localization set the default locale parameter replacing other parameters
body: <p>I am new to laravel. when I set the default locale from localization.php and I click on any of my data list edit buttons it replaces the id variable to locale value like (en/ ur/ sd).</p>
  <p>then I remove the default locale parameter from Localization.php</p>
  <p>ill get Missing parameter: about</p>
  <p>web.php</p>
  <pre><code>Route::group([
      'prefix' =&gt; '{locale}', 
      'where' =&gt; ['locale' =&gt; '[a-zA-Z]{2}'], 
      'middleware' =&gt; 'Localization'
      ], function() {
  
  
          Route::get('/', function () {
              return redirect(route('home'));
          });
          
  Route::resource('/about', AboutController::class)-&gt;middleware('auth');
  });
  </code></pre>
  <p>kernel.php</p>
  <pre><code>protected $routeMiddleware = [
          'auth' =&gt; \App\Http\Middleware\Authenticate::class,
          'auth.basic' =&gt; \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
          'cache.headers' =&gt; \Illuminate\Http\Middleware\SetCacheHeaders::class,
          'can' =&gt; \Illuminate\Auth\Middleware\Authorize::class,
          'guest' =&gt; \App\Http\Middleware\RedirectIfAuthenticated::class,
          'password.confirm' =&gt; \Illuminate\Auth\Middleware\RequirePassword::class,
          'signed' =&gt; \Illuminate\Routing\Middleware\ValidateSignature::class,
          'throttle' =&gt; \Illuminate\Routing\Middleware\ThrottleRequests::class,
          'verified' =&gt; \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
  
          // Permission
          'role' =&gt; \Spatie\Permission\Middlewares\RoleMiddleware::class,
          'permission' =&gt; \Spatie\Permission\Middlewares\PermissionMiddleware::class,
          'role_or_permission' =&gt; \Spatie\Permission\Middlewares\RoleOrPermissionMiddleware::class,
          'Localization' =&gt; \App\Http\Middleware\Localization::class,
      ];
  </code></pre>
  <p>Localization.php</p>
  <pre><code>class Localization
  {
      /**
      * Handle an incoming request.
      *
      * @param  \Illuminate\Http\Request  $request
      * @param  \Closure  $next
      * @return mixed
      */
      public function handle(Request $request, Closure $next)
      {        
  
          URL::defaults(['locale' =&gt; $request-&gt;segment(1)]);
          app()-&gt;setLocale($request-&gt;segment(1));
          return $next($request);
          
          
      }
  }
  </code></pre>
  <p>AboutController.php edit function</p>
  <pre><code>public function edit($id)
      {
         
          $singleRow = About::find($id); 
          $allRows = About::all();
          return view('about', compact('allRows','singleRow'));
      }
  </code></pre>
  <p>app.php</p>
  <pre><code>'locale' =&gt; 'en',
  'fallback_locale' =&gt; 'en',
  
      'available_locales' =&gt; [
           'en',
           'sd',
           'ur',
        ],
  </code></pre>
  <p>about.blade.php  Edit section when I click here for edit data</p>
  <p>if I try without app()-&gt;getLocale() and the locale parameter is assigned from Localization.php
  I ll replace the id as selected locale language like en, sd, ur whatever is given in URL like <a href="http://127.0.0.1:8000/en/about/1/edit" rel="nofollow noreferrer">http://127.0.0.1:8000/en/about/1/edit</a></p>
  <p>1st try with default locale parameter mentioned above</p>
  <pre><code>&lt;a href=&quot;{{ route('about.edit', ['about' =&gt; $about-&gt;id]) }}&quot; class=&quot;btn btn-primary&quot;&gt;Edit&lt;/a&gt; 
  </code></pre>
  <p>second try without locale parameter mentioned above</p>
  <pre><code>&lt;a href=&quot;{{ route('about.edit', ['locale'=&gt; app()-&gt;getLocale(), 'about' =&gt; $about-&gt;id]) }}&quot; class=&quot;btn btn-primary&quot;&gt;Edit&lt;/a&gt; 
  </code></pre>
  <p>in this time I have set the default locale from Localization.php mentioned above and removed the locale parameter from my tag</p>
  <pre><code>&lt;a href=&quot;{{ route('about.edit', ['about' =&gt; $about-&gt;id]) }}&quot; class=&quot;btn btn-primary&quot;&gt;Edit&lt;/a&gt; 
  </code></pre>
  <p>I get this in my browser when I clicked on edit button</p>
  <p>changed return to dd</p>
  <pre><code>public function edit($id)
      {
         
          dd($id);
          $singleRow = About::find($id); 
          $allRows = About::all();
          return view('about', compact('allRows','singleRow'));
  
      }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/CJsRt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CJsRt.png" alt="image is here" /></a></p>
  <p>in this time I commented on the locale parameter from Localization.php and added the locale parameter in my tag</p>
  <pre><code>&lt;a href=&quot;{{ route('about.edit', ['locale'=&gt; app()-&gt;getLocale(), 'about' =&gt; $about-&gt;id]) }}&quot; class=&quot;btn btn-primary&quot;&gt;Edit&lt;/a&gt;
  </code></pre>
  <p><a href="https://i.stack.imgur.com/mLylT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mLylT.png" alt="enter image description here" /></a></p>