Skip to content

Instantly share code, notes, and snippets.

@nissicreative
Last active December 19, 2020 21:53
Show Gist options
  • Save nissicreative/9d7eb7d0228ba07daa8659d5ae498fe2 to your computer and use it in GitHub Desktop.
Save nissicreative/9d7eb7d0228ba07daa8659d5ae498fe2 to your computer and use it in GitHub Desktop.
Laravel Web Routes Stub
<?php
use Illuminate\Http\Request;
/*
|--------------------------------------------------------------------------
| Public Routes
|--------------------------------------------------------------------------
*/
// Welcome Page
Route::get('/', 'WelcomeController')->name('welcome');
// Marketing/Info Pages
Route::get('about', 'PagesController@about')->name('pages.about');
// Contact Form
Route::get('contact', 'ContactController@index')->name('contact.index');
Route::post('contact', 'ContactController@submit');
Route::get('thanks', 'ContactController@thanks')->name('contact.thanks');
/*
|--------------------------------------------------------------------------
| Authorized User Routes
|--------------------------------------------------------------------------
*/
Auth::routes();
Route::get('logout', 'Auth\LoginController@logout')->name('logout');
Route::get('home', 'HomeController@index')->name('home');
/*
|--------------------------------------------------------------------------
| Administrator Routes
|--------------------------------------------------------------------------
*/
Route::group([
'namespace' => 'Admin',
'prefix' => 'admin', // routes beginning with admin/
'as' => 'admin.', // named routes
'middleware' => ['auth', 'admin'],
], function () {
// Admin DashboardController
Route::get('/', 'AdminController@index')->name('dashboard');
Route::get('account', 'AdminController@account')->name('account');
Route::post('account', 'AdminController@postAccount')->name('account.update');
// Resource Routes
Route::resource('users', 'UsersController');
});
/*
|--------------------------------------------------------------------------
| Development Routes
|--------------------------------------------------------------------------
*/
if (App::environment('local')) {
// Generate a string of "fillable" fields for an Eloquent model
Route::get('fillable/{table}', function (Request $request, $table) {
$columns = Schema::getColumnListing($table);
$hidden = ['id', 'created_at', 'updated_at', 'deleted_at'];
$filtered = array_diff($columns, $hidden);
$quoted = array_map(function ($val) {
return sprintf("'%s'", $val);
}, $filtered);
echo implode(', ', $quoted);
});
// Generic test route to use for whatever...
Route::get('test', function () {
abort(403);
});
// Run an artisan command
Route::get('artisan/{command}', function ($command) {
$exitCode = Artisan::call($command);
dd($exitCode);
});
// Send a test error to Bugsnag.
Route::get('bugsnag', function () {
Bugsnag::notifyError('ErrorType', 'Test Error');
return response('Error reported.');
});
// Test email delivery.
Route::get('mailtest', function () {
Mail::send('emails.test', compact('user'), function ($m) {
$m->from(from_address(), from_name());
$m->to('mike@nissicreative.com', 'Mike Folsom');
$m->subject('Test Email');
});
return response('Mail sent.');
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment