Skip to content

Instantly share code, notes, and snippets.

@ejntaylor
Created June 24, 2020 13:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ejntaylor/ffdebd4cee9479527a14cb0a91c4b658 to your computer and use it in GitHub Desktop.
Save ejntaylor/ffdebd4cee9479527a14cb0a91c4b658 to your computer and use it in GitHub Desktop.
Statamic and Nova route example problem
<?php
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Route;
use Statamic\Facades\OAuth;
use Statamic\Statamic;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
// Dev Testing
Route::inertia('/links', 'links')->name('links');
// Pages
Route::get('/', 'HomeController@index')->name('home');
Route::inertia('about', 'about')->name('about');
Route::inertia('contact', 'contact')->name('contact');
Route::post('/contact', 'MailController@sendContactEmail')->name('contact.send');
// Auth
Auth::routes();
// Statamic
Route::name('statamic.')->group(function () {
/**
* Glide
* On-the-fly URL-based image transforms.
*/
Route::group(['prefix' => Config::get('statamic.assets.image_manipulation.route')], function () {
Route::get('/asset/{container}/{path?}', 'GlideController@generateByAsset')->where('path', '.*');
Route::get('/http/{url}/{filename?}', 'GlideController@generateByUrl');
Route::get('{path}', 'GlideController@generateByPath')->where('path', '.*');
});
Route::group(['prefix' => config('statamic.routes.action')], function () {
Route::post('forms/{form}', 'FormController@submit')->name('forms.submit');
Route::get('protect/password', '\Statamic\Auth\Protect\Protectors\Password\Controller@show')->name('protect.password.show');
Route::post('protect/password', '\Statamic\Auth\Protect\Protectors\Password\Controller@store')->name('protect.password.store');
Route::group(['prefix' => 'auth'], function () {
Route::post('login', 'UserController@login')->name('login');
Route::get('logout', 'UserController@logout')->name('logout');
Route::post('register', 'UserController@register')->name('register');
Route::post('password/email', 'ForgotPasswordController@sendResetLinkEmail')->name('password.email');
Route::get('password/reset/{token}', 'ResetPasswordController@showResetForm')->name('password.reset');
Route::post('password/reset', 'ResetPasswordController@reset')->name('password.reset.action');
Route::get('activate/{token}', 'ActivateAccountController@showResetForm')->name('account.activate');
Route::post('activate', 'ActivateAccountController@reset')->name('account.activate.action');
});
Statamic::additionalActionRoutes();
});
if (OAuth::enabled()) {
Route::get(config('statamic.oauth.routes.login'), 'OAuthController@redirectToProvider')->name('oauth.login');
Route::get(config('statamic.oauth.routes.callback'), 'OAuthController@handleProviderCallback')->name('oauth.callback');
}
});
// Statamic::additionalWebRoutes();
/**
* Front-end
* All front-end website requests go through a single controller method.
*/
Route::any('/{segments?}', '\Statamic\Http\Controllers\FrontendController@index')
->where('segments', '^(?!nova|cp).*$')
->name('statamic.site');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment