jeudi 28 mars 2019

Laravel: Trying to get url (with prefix) in complete laravel application

Using Laravel 5.6 version. I have following code in routes/web.php file

Route::prefix('farmapp')->group(function () {

Route::get('/', 'Admin\DashboardController@index');

Route::get('/units', 'Admin\UnitController@index');

});

As you can see above, I am using prefix 'farmapp' so that all application url's start with 'farmapp', e.g localhost/arainfarms/farmapp and localhost/arainfarms/farmapp/units

Now coming to menubar/sidebar links:

<ul class="nav nav-tabs border-0 flex-column flex-lg-row">
  <li class="nav-item">
    <a href="" class="nav-link active"><i class="fe fe-home"></i> Home</a>
   </li>

  <li class="nav-item">
    <a href="" class="nav-link"><i class="fe fe-check-square"></i> Farm Units</a>
  </li>
</ul>

As you can see I am using farmapp prefix in every url. In future if I want to change farmapp to some other prefix, I can easily change in web file, but as there are so many links in sidebar and other application files and I have to change farmapp to new one in all these files and it's some time taking..so is there any way/strategy/Laravel Function to update all these url's automatically by changing prefix in web file? In short I don't want to add prefix in all these file url's. By giving prefix on web , this prefix automatically add in sidebar/other files.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2FBNUI8
via IFTTT

Aucun commentaire:

Enregistrer un commentaire