Wave logo

Routing

In this section we'll quickly cover the Wave routes.


Wave Web Routes

If you take a look inside of wave/routes/web.php you will see all the Wave web routes:

Route::impersonate();

Route::get('/', '\Wave\Http\Controllers\[email protected]')->name('wave.home');
Route::get('@{username}', '\Wave\Http\Controllers\[email protected]')->name('wave.profile');

// Additional Auth Routes
Route::get('logout', 'Auth\[email protected]')->name('logout');
Route::get('user/verify/{verification_code}', 'Auth\[email protected]')->name('verify');
Route::post('register/subscribe', '\Wave\Http\Controllers\[email protected]')->name('wave.register-subscribe');

Route::get('blog', '\Wave\Http\Controllers\[email protected]')->name('wave.blog');
Route::get('blog/{category}', '\Wave\Http\Controllers\[email protected]')->name('wave.blog.category');
Route::get('blog/{category}/{post}', '\Wave\Http\Controllers\[email protected]')->name('wave.blog.post');

/***** Pages *****/
Route::get('p/{page}', '\Wave\Http\Controllers\[email protected]');

/***** Billing Webhook *****/
Route::post('/billing/webhook', 'Wave\Http\Controllers\[email protected]');

Route::group(['middleware' => 'wave'], function () {
    Route::get('dashboard', '\Wave\Http\Controllers\[email protected]')->name('wave.dashboard');
});

Route::group(['middleware' => 'auth'], function(){
    Route::get('settings/{section?}', '\Wave\Http\Controllers\[email protected]')->name('wave.settings');

    Route::post('settings/profile', '\Wave\Http\Controllers\[email protected]')->name('wave.settings.profile.put');
    Route::put('settings/security', '\Wave\Http\Controllers\[email protected]')->name('wave.settings.security.put');

    Route::post('settings/api', '\Wave\Http\Controllers\[email protected]')->name('wave.settings.api.post');
    Route::put('settings/api/{id}', '\Wave\Http\Controllers\[email protected]')->name('wave.settings.api.put');
    Route::delete('settings/api/{id}', '\Wave\Http\Controllers\[email protected]')->name('wave.settings.api.delete');

    Route::get('settings/invoices/{invoice}', '\Wave\Http\Controllers\[email protected]')->name('wave.invoice');

    Route::get('notifications', '\Wave\Http\Controllers\[email protected]')->name('wave.notifications');
    Route::get('announcements', '\Wave\Http\Controllers\[email protected]')->name('wave.announcements');
    Route::get('announcement/{id}', '\Wave\Http\Controllers\[email protected]')->name('wave.announcement');
    Route::post('announcements/read', '\Wave\Http\Controllers\[email protected]')->name('wave.announcements.read');
    Route::get('notifications', '\Wave\Http\Controllers\[email protected]')->name('wave.notifications');
    Route::post('notification/read/{id}', '\Wave\Http\Controllers\[email protected]')->name('wave.notification.read');

    Route::post('subscribe', '\Wave\Http\Controllers\[email protected]')->name('wave.subscribe');
    Route::get('subscription/cancel', '\Wave\Http\Controllers\[email protected]')->name('wave.cancel');
    Route::get('subscription/reactivate', '\Wave\Http\Controllers\[email protected]')->name('wave.reactivate');
    Route::post('plans/update', '\Wave\Http\Controllers\[email protected]_plans')->name('wave.update_plan');
    Route::post('update_credit_card', '\Wave\Http\Controllers\[email protected]_credit_card')->name('wave.update_credit_card');
    Route::view('trial_over', 'theme::trial_over')->name('wave.trial_over');
    Route::view('cancelled', 'theme::cancelled')->name('wave.cancelled');
});

Next, if you take a look inside of your routes/web.php, you will see the following line:

// Include Wave Routes
Wave::routes();

This line includes all the Wave routes into your application.

Wave API Routes

The Wave API routes are located at wave/routes/api.php. The contents of the file are as follows:

Route::post('login', '\Wave\Http\Controllers\API\[email protected]');
Route::post('register', '\Wave\Http\Controllers\API\[email protected]');
Route::post('logout', '\Wave\Http\Controllers\API\[email protected]');
Route::post('refresh', '\Wave\Http\Controllers\API\[email protected]');
Route::post('token', '\Wave\Http\Controllers\API\[email protected]');

// BROWSE
Route::get('/{datatype}', '\Wave\Http\Controllers\API\[email protected]');

// READ
Route::get('/{datatype}/{id}', '\Wave\Http\Controllers\API\[email protected]');

// EDIT
Route::put('/{datatype}/{id}', '\Wave\Http\Controllers\API\[email protected]');

// ADD
Route::post('/{datatype}', '\Wave\Http\Controllers\API\[email protected]');

// DELETE
Route::delete('/{datatype}/{id}', '\Wave\Http\Controllers\API\[email protected]');

Then, if you take a look inside of your routes/api.php, you will see the following line:

// Include Wave Routes
Wave::api();

This line includes all the Wave API routes into your application API.

Wave Middleware

Inside of the Wave routes.php file you will see the following line:

Route::group(['middleware' => 'wave'], function () {
    Route::get('dashboard', '\Wave\Http\Controllers\[email protected]')->name('wave.dashboard');
});

This is the only current route protected by the wave middleware. The wave middleware is used to protect routes against users who no longer have an active subscription or are no longer on a trial. You can include your application routes inside of this middleware:

Route::group(['middleware' => 'wave'], function () {
    // Add your application routes here.
});

You may also wish to include this middleware in a single route:

Route::get('awesome', '[email protected]')->middleware('wave');

And now your application routes will be protected from users who are no longer active paying users.