Home Arrow Icon Knowledge base Arrow Icon Global Arrow Icon Can I customize the admin path for Twill in Laravel Sail
    Twill Laravel Sail customize admin path Laravel routes ADMIN_APP_PATH Twill admin console Laravel development


Can I customize the admin path for Twill in Laravel Sail


Yes, you can customize the admin path for Twill in a Laravel Sail environment. Here's how you can do it:

1. Set the `ADMIN_APP_PATH` Environment Variable:

In your project's `.env` file, add the following line to specify the custom admin path:


   ADMIN_APP_PATH=/custom-admin-path
   

This will make the Twill admin console available at `https://localhost/custom-admin-path` instead of the default `/admin` path.

2. Update the Twill Routes:

In your project's `routes/twill.php` file, you'll need to update the admin routes to use the custom path. For example:

php
   Route::group(['prefix' => config('twill.admin_app_path')], function () {
       // Your Twill admin routes go here
   });
   

This will ensure that all Twill admin routes are prefixed with the custom path you specified in the `.env` file.

3. Verify the Custom Admin Path in Laravel Sail:

Start your Laravel Sail environment using the `./vendor/bin/sail up` command. Once the environment is running, you should be able to access the Twill admin console at `https://localhost/custom-admin-path`.

That's it! By setting the `ADMIN_APP_PATH` environment variable and updating the Twill routes, you've successfully customized the admin path for Twill in your Laravel Sail environment.

Remember that if you're using a subdomain for the Twill admin console (e.g., `https://admin.example.com`), you'll need to set the `ADMIN_APP_URL` environment variable instead of `ADMIN_APP_PATH`. The process is similar, but you'll need to ensure that the subdomain is properly configured in your development environment (e.g., adding an entry to your `/etc/hosts` file).

Citations:
[1] https://laracasts.com/discuss/channels/laravel/is-there-a-way-to-make-laravel-sail-use-a-different-path
[2] https://tech.codivores.com/ltivt-5-laravel-twill-first-module
[3] https://twillcms.com/docs/getting-started/installation.html
[4] https://tech.codivores.com/ltivt-4-laravel-twill-basics
[5] https://dev.to/themeselection/the-ultimate-laravel-resourcesfor-developers2022-2nae