<?php

/*
|--------------------------------------------------------------------------
| 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!
|
*/
if (env('APP_ENV') === 'production') {
    URL::forceScheme('https');
}
Auth::routes(['register' => false]);

Route::get('auth/social/{provider}', 'Auth\SocialiteController@redirectToProvider');
Route::get('auth/social/{provider}/callback', 'Auth\SocialiteController@handleProviderCallback');

Route::get('/', [ 'uses' => 'PagesController@home']);
Route::get('home', [ 'uses' => 'PagesController@home']);
Route::get('winningbidderlist', [ 'uses' => 'PagesController@winningbidderlist']);
Route::get('showwinners', [ 'uses' => 'PagesController@showwinners']);
Route::get('showscores', [ 'uses' => 'PagesController@showscores']);
Route::get('showscoresbycar', [ 'uses' => 'PagesController@showscoresbycar']);
Route::get('mywinnings', [ 'uses' => 'PagesController@myWinnings']);
Route::post('mywinnings', [ 'uses' => 'PagesController@myWinnings']);

Route::group(['middleware' => 'auth'], function() {
  Route::get('bidders', [ 'uses' => 'PagesController@bidders']);
  Route::post('bidders', [ 'uses' => 'PagesController@bidders']);
  Route::get('bidderlist', [ 'uses' => 'PagesController@bidderlist']);
  Route::post('bidderlist', [ 'uses' => 'PagesController@bidderlist']);
  Route::get('checkout', [ 'uses' => 'PagesController@checkout']);
  Route::post('checkout', [ 'uses' => 'PagesController@checkout']);
  Route::get('checkout_complete_list', [ 'uses' => 'PagesController@checkoutCompleteList' ]);
  Route::get('editwinners', [ 'uses' => 'PagesController@editwinners']);
  Route::post('editwinners', [ 'uses' => 'PagesController@editwinners']);
  Route::get('finaltally', [ 'uses' => 'PagesController@finaltally']);
  Route::get('items', [ 'uses' => 'PagesController@items']);
  Route::post('items', [ 'uses' => 'PagesController@items']);
  Route::get('itemlist', [ 'uses' => 'PagesController@itemlist']);
  Route::post('itemlist', [ 'uses' => 'PagesController@itemlist']);
  Route::get('reprint_receipt', ['uses' => 'PagesController@reprintReceipt']);
  Route::post('reprint_receipt', ['uses' => 'PagesController@reprintReceipt']);
  Route::get('receiptpdf', ['uses' => 'PagesController@receiptpdf'])->name('receiptpdf');
  Route::get('winners', [ 'uses' => 'PagesController@winners']);
  Route::post('winners', [ 'uses' => 'PagesController@winners']);
  Route::get('winnerlist', [ 'uses' => 'PagesController@winnerlist']);
  Route::post('winnerlist', [ 'uses' => 'PagesController@winnerlist']);
  Route::get('winnersbyitem', [ 'uses' => 'PagesController@winnersbyitem']);
  Route::get('winnertotal', [ 'uses' => 'PagesController@winnertotal']);
  Route::post('winnertotal', [ 'uses' => 'PagesController@winnertotal']);
  Route::get('showcars', [ 'uses' => 'PagesController@showcars']);
  Route::get('judgingentry', [ 'uses' => 'PagesController@judgingentry']);
  Route::get('pcentry', [ 'uses' => 'PagesController@pcentry']);
  Route::get('judges', [ 'uses' => 'PagesController@judges']);
  Route::get('vehicletypes', [ 'uses' => 'PagesController@vehicletypes']);
  Route::get('awardcategories', [ 'uses' => 'PagesController@awardcategories']);
  Route::post('showcars', [ 'uses' => 'PagesController@showcars']);
  Route::post('judgingentry', [ 'uses' => 'PagesController@judgingentry']);
  Route::post('pcentry', [ 'uses' => 'PagesController@pcentry']);
  Route::post('judges', [ 'uses' => 'PagesController@judges']);
  Route::post('vehicletypes', [ 'uses' => 'PagesController@vehicletypes']);
  Route::post('awardcategories', [ 'uses' => 'PagesController@awardcategories']);
  Route::get('showcarlist', [ 'uses' => 'PagesController@showcarlist']);
  Route::get('tabulateshowwinners', function() {
    Artisan::call('carshow:tabulatewinners');
    return redirect('showwinners');
  });
});
