Routing

After installing hotCoffee you will see 2 additional lines were added in routes/web.php.

HotCoffee::routes();

This is where the admin routes will be rendered. You can change the admin prefix inconfig/hotcoffee.php if you wish to do so.

Route::get('{keyword}', '\TaffoVelikoff\LaravelSef\Http\Controllers\SefController@viaProperty')->name('sef');

This line is for the custom URLs of your info pages, articles and any other models you create that use the HasSef trait. Always keep this at the bottom of routes.php as your last route. You can read more about it in the Traits section or visit https://github.com/TaffoVelikoff/laravel-sef for the full documentation.

When you need to add new routes for your admin panel you can do something like this right afterHotCoffee::routes():

use Illuminate\Support\Facades\Route;
use Http\Controllers\Front\ExampleController;
use Http\Controllers\Front\AnotherController;

Route::group(['prefix' => config('hotcoffee.prefix'), 'middleware' => ['hotcoffee']], function () {
    
    Route::get('/example', [ExampleController::class, 'method'])->name('admin.example');
    Route::get('/another', [AnotherController::class, 'method'])->name('admin.another');
    
});

Alternatively you can publish the admin routes if you prefer or need to edit any of them.

php artisan hotcoffee:publish-routes

This will create an admin.php file inside the routes folder of your project. Next, edit the routes.php:

// Remove or comment out the line below
HotCoffee::routes();

// Import the new routes file
require('admin.php');

Now you are free to not only add new routes for your admin zone, but also edit any of them.

Last updated