Routing
After installing hotCoffee you will see 2 additional lines were added in routes/web.php.
1
HotCoffee::routes();
Copied!
This is where the admin routes will be rendered. You can change the admin prefix inconfig/hotcoffee.php if you wish to do so.
1
Route::get('{keyword}', '\TaffoVelikoff\LaravelSef\Http\Controllers\[email protected]')->name('sef');
Copied!
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():
1
use Illuminate\Support\Facades\Route;
2
use Http\Controllers\Front\ExampleController;
3
use Http\Controllers\Front\AnotherController;
4
5
Route::group(['prefix' => config('hotcoffee.prefix'), 'middleware' => ['hotcoffee']], function () {
6
7
Route::get('/example', [ExampleController::class, 'method'])->name('admin.example');
8
Route::get('/another', [AnotherController::class, 'method'])->name('admin.another');
9
10
});
Copied!
Alternatively you can publish the admin routes if you prefer or need to edit any of them.
1
php artisan hotcoffee:publish-routes
Copied!
This will create an admin.php file inside the routes folder of your project. Next, edit the routes.php:
1
// Remove or comment out the line below
2
HotCoffee::routes();
3
4
// Import the new routes file
5
require('admin.php');
Copied!
Now you are free to not only add new routes for your admin zone, but also edit any of them.
Last modified 9mo ago
Copy link